Skip to content

Commit ae2f960

Browse files
authored
Configure required GHA jobs for merge_group (#196)
We recently configured docs-website to use merge queues, and have one job with a `merge_group` trigger. Since the required checks do not have a `merge_group` trigger, though, merge queues time out waiting for checks to be reported. - Move the docs build check into Amplify Preview. A job called "Amplify Preview" is required to run. Move the "Check the docs build" step into the docs preview workflow. Run one of two "Amplify Preview" jobs depending on the event type. - Trigger all expected workflows on the `merge_group` event, but add an `if` condition so they pass if the event is merge_group. Do not add an `if` condition to the `Dependency Review` job, since it seems to conflict with the `uses` field. The job takes < 30s, so there is not much harm in running it on `merge_group`.
1 parent 7ec33cf commit ae2f960

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

.github/workflows/amplify-preview.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name: Docs Preview
22
on:
33
pull_request:
4+
merge_group:
45

56
permissions:
67
pull-requests: write
78
id-token: write
89

910
jobs:
1011
amplify-preview:
12+
if: ${{ github.event_name != 'merge_group' }}
1113
name: Amplify Preview
1214
runs-on: ubuntu-22.04-2core-arm64
1315
environment: docs-amplify
@@ -25,3 +27,32 @@ jobs:
2527
create_branches: "false"
2628
github_token: ${{ secrets.GITHUB_TOKEN }}
2729
wait: "true"
30+
31+
# If the event is merge_group, we want to make sure the build passes with the
32+
# most recent version of the docs content to prevent unexpected inputs from
33+
# breaking the build. Execute a local build on the GitHub Actions runner
34+
# without a preview link.
35+
local-preview:
36+
if: ${{ github.event_name == 'merge_group'}}
37+
name: Amplify Preview
38+
runs-on: ubuntu-22.04-2core-arm64
39+
steps:
40+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
42+
with:
43+
node-version: 23
44+
cache: 'yarn'
45+
- name: Install deps
46+
run: yarn
47+
- name: Prepare docs site configuration
48+
# Replace data fetched from Sanity CMS with hardcoded JSON objects to
49+
# remove the need to authenticate with Sanity. Each includes the minimal
50+
# set of data required for docs builds to succeed.
51+
run: |
52+
NEW_PACKAGE_JSON=$(jq '.scripts."prepare-sanity-data" = "echo Using pre-populated Sanity data"' package.json);
53+
echo "$NEW_PACKAGE_JSON" > package.json;
54+
echo "{}" > data/events.json
55+
echo '{"bannerButtons":{"second":{"title":"LOG IN","url":"https://teleport.sh"},"first":{"title":"Support","url":"https://goteleport.com/support/"}},"navbarData":{"rightSide":{},"logo":"/favicon.svg","menu":[]}}' > data/navbar.json
56+
57+
- name: Build the docs with the latest content
58+
run: yarn build

.github/workflows/check-build.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ on:
99
branches:
1010
- main
1111
- dev
12+
merge_group:
1213

1314
jobs:
1415
analyze:
15-
name: Analyze
16+
if: ${{ github.event_name != 'merge_group' }}
17+
name: CodeQL
1618
runs-on: ubuntu-latest
1719
permissions:
1820
actions: read

.github/workflows/dependency-review.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Dependency Review
22

33
on:
44
pull_request:
5+
merge_group:
56

67
jobs:
78
dependency-review:

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Test
22
on:
33
pull_request:
4+
merge_group:
45

56
jobs:
67
run-tests:
78
name: Run tests
9+
if: ${{ github.event_name != 'merge_group' }}
810
runs-on: ubuntu-22.04-2core-arm64
911
steps:
1012
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

0 commit comments

Comments
 (0)