Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ name: CI
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, edited]
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
# `edited` also covers title and body changes. Isolate those no-op runs so
# they cannot cancel the check for the current pull request revision.
group: ci-${{ github.workflow }}-${{ github.ref }}${{ github.event.action == 'edited' && github.event.changes.base.ref.from == '' && format('-ignored-{0}', github.run_id) || '' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
Expand All @@ -35,6 +38,10 @@ jobs:
# Planning and every selected Linux surface share one runner, so the core
# workflow consumes one automatic job without dropping affected coverage.
test:
# A base-ref edit keeps the protected `CI / test` name. Other edits create
# only a differently named skipped check, so they cannot satisfy it.
name: ${{ github.event_name == 'pull_request' && github.event.action == 'edited' && github.event.changes.base.ref.from == '' && 'ignored-edit' || 'test' }}
if: ${{ github.event_name != 'pull_request' || github.event.action != 'edited' || github.event.changes.base.ref.from != '' }}
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
Expand Down
19 changes: 19 additions & 0 deletions scripts/ci-test-plan.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,25 @@ test('core CI validates pull requests and the resulting main branch state', () =
assert.match(workflow, /\[\[ "\$BASE_SHA" =~ \^0\+\$ \]\]/u);
});

test('core CI runs on base retargets without letting metadata edits replace the required check', () => {
const workflow = readWorkflow('ci.yml');

assert.match(workflow, /types: \[opened, synchronize, reopened, edited\]/u);
assert.match(
workflow,
/group: ci-\$\{\{ github\.workflow \}\}-\$\{\{ github\.ref \}\}\$\{\{ github\.event\.action == 'edited' && github\.event\.changes\.base\.ref\.from == '' && format\('-ignored-\{0\}', github\.run_id\) \|\| '' \}\}/u,
);
assert.match(workflow, /cancel-in-progress: \$\{\{ github\.event_name == 'pull_request' \}\}/u);
assert.match(
workflow,
/name: \$\{\{ github\.event_name == 'pull_request' && github\.event\.action == 'edited' && github\.event\.changes\.base\.ref\.from == '' && 'ignored-edit' \|\| 'test' \}\}/u,
);
assert.match(
workflow,
/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.event\.action != 'edited' \|\| github\.event\.changes\.base\.ref\.from != '' \}\}/u,
);
});

test('core CI uses the Windows inventory package-script authority', () => {
const workflow = readWorkflow('ci.yml');

Expand Down
Loading