Add unified status check #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Merge group tests | |
on: | |
merge_group: | |
pull_request: | |
jobs: | |
test-ref: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'merge_group' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Print branch names | |
run: | | |
echo "Head ref: ${{ github.event.merge_group.head_ref }}" | |
echo "Base ref: ${{ github.event.merge_group.base_ref }}" | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.merge_group.base_ref }} | |
test-ref-b: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Print branch name | |
run: | | |
echo "Base ref: ${{ github.base_ref }}" | |
# Wait and verify job | |
wait-and-verify: | |
if: always() | |
needs: [test-ref, test-ref-b] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check job statuses | |
run: | | |
# Check the statuses of the dependent jobs | |
if [[ "${{ needs.test-ref.result }}" == "failure" || \ | |
"${{ needs.test-ref-b.result }}" == "failure" ]]; then | |
echo "One or more jobs failed." | |
exit 1 | |
else | |
echo "All jobs succeeded or were skipped." | |
fi |