mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-06 12:22:03 +00:00
ci: run required checks on merge_group for the merge queue (#236)
governance and Build and test are the required checks on main. A merge queue only counts checks that ran on the merge_group event, so the workflow now triggers on it. The governance gate reads the merge group's own base SHA because github.event.before is empty there.
This commit is contained in:
parent
7c470d389c
commit
e611f193bd
1 changed files with 7 additions and 0 deletions
7
.github/workflows/ci.yaml
vendored
7
.github/workflows/ci.yaml
vendored
|
|
@ -3,6 +3,9 @@ name: Frontend checks
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, dev]
|
branches: [main, dev]
|
||||||
|
# The merge queue builds main plus the queued pull requests on a temporary
|
||||||
|
# branch and only counts checks that ran on the merge_group event.
|
||||||
|
merge_group:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
@ -32,6 +35,7 @@ jobs:
|
||||||
#
|
#
|
||||||
# GOVERNANCE_BASE points the changed-file gate at the right diff:
|
# GOVERNANCE_BASE points the changed-file gate at the right diff:
|
||||||
# PR -> the PR target branch (origin/<base_ref>)
|
# PR -> the PR target branch (origin/<base_ref>)
|
||||||
|
# merge group -> the group's own base (github.event.merge_group.base_sha)
|
||||||
# push-> the previous commit on the branch (github.event.before)
|
# push-> the previous commit on the branch (github.event.before)
|
||||||
# manual -> main, for exact-head recovery runs
|
# manual -> main, for exact-head recovery runs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -46,10 +50,13 @@ jobs:
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
EVENT_BEFORE: ${{ github.event.before }}
|
EVENT_BEFORE: ${{ github.event.before }}
|
||||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||||
|
MERGE_GROUP_BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
|
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
|
||||||
base="${PR_BASE_SHA}"
|
base="${PR_BASE_SHA}"
|
||||||
|
elif [[ "${EVENT_NAME}" == "merge_group" && -n "${MERGE_GROUP_BASE_SHA}" ]]; then
|
||||||
|
base="${MERGE_GROUP_BASE_SHA}"
|
||||||
elif [[ "${EVENT_NAME}" == "push" && -n "${EVENT_BEFORE}" && ! "${EVENT_BEFORE}" =~ ^0+$ ]]; then
|
elif [[ "${EVENT_NAME}" == "push" && -n "${EVENT_BEFORE}" && ! "${EVENT_BEFORE}" =~ ^0+$ ]]; then
|
||||||
base="${EVENT_BEFORE}"
|
base="${EVENT_BEFORE}"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue