Skip to content

Commit f8a1fcd

Browse files
committed
[TASK] Cover direct pushes and the merge queue in the asset check
The check only triggered on pull_request. Two paths past it: Security advisory fixes are merged out of a temporary private fork and land on "main" as direct commits, never as a pull request in this repo, so the gate could not see them. That is how 0.40.0 shipped assets built before the fixes it was tagged for. "main" gained a merge queue in #1326 after this branch was opened. A required status check without a merge_group trigger never reports on a queued merge, which times the merge out. Add both triggers. The base sha now comes from the event payload, and an event without one, a push, is verified in full rather than skipped. Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
1 parent ac5ad0d commit f8a1fcd

1 file changed

Lines changed: 31 additions & 6 deletions

File tree

.github/workflows/check-built-assets.yaml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,26 @@
88
# forever ("Expected — waiting for status"). PRs that don't touch the theme
99
# package short-circuit to success without building.
1010
#
11+
# The push trigger is not redundant with the pull_request one: security
12+
# advisory fixes are merged out of a temporary private fork and arrive on
13+
# "main" as direct commits without ever being a pull request here, so the
14+
# pull_request trigger alone cannot see them. That is how the 0.40.0 assets
15+
# came to be published without the fixes they were tagged for.
16+
#
17+
# merge_group is required because "main" uses a merge queue: without it,
18+
# queued merges never receive this required status check and time out.
19+
#
1120
# The companion dependabot-rebuild-assets.yaml is the convenience layer that
1221
# keeps Dependabot PRs from tripping this check.
1322

1423
name: "Check built assets"
1524

1625
on: # yamllint disable-line rule:truthy
1726
pull_request:
27+
push:
28+
branches:
29+
- "main"
30+
merge_group:
1831

1932
permissions: {}
2033

@@ -44,15 +57,27 @@ jobs:
4457
persist-credentials: false
4558
fetch-depth: 0
4659

47-
# Skip the (relatively expensive) build for PRs that don't touch the
48-
# theme package. The job still completes successfully, so the required
49-
# "verify" status is reported on every PR.
60+
# Skip the (relatively expensive) build when the theme package was not
61+
# touched. The job still completes successfully, so the required
62+
# "verify" status is reported on every pull request and every queued
63+
# merge.
64+
#
65+
# A push to "main" is always verified in full: it is the trigger that
66+
# catches commits which never were a pull request here, and a fork
67+
# merge leaves no reliable base to diff against.
68+
#
69+
# The base sha is read from the event payload rather than interpolated
70+
# into the script.
5071
- name: "Detect theme-package changes"
5172
id: scope
52-
env:
53-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
5473
run: |
55-
if git diff --name-only "$BASE_SHA" HEAD -- packages/typo3-docs-theme/ | grep -q .; then
74+
filter='.pull_request.base.sha // .merge_group.base_sha // ""'
75+
base="$(jq -r "$filter" "$GITHUB_EVENT_PATH")"
76+
77+
if [ -z "$base" ]; then
78+
echo "changed=true" >> "$GITHUB_OUTPUT"
79+
echo "Event '$GITHUB_EVENT_NAME' has no base — full verify."
80+
elif git diff --name-only "$base" HEAD -- packages/typo3-docs-theme/ | grep -q .; then
5681
echo "changed=true" >> "$GITHUB_OUTPUT"
5782
else
5883
echo "changed=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)