Skip to content

Commit

Permalink
fix: Add new job to verify "All jobs pass" job for required PR check (#…
Browse files Browse the repository at this point in the history
…11121)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

This PR adds a new job called `check-all-jobs-pass`, which verifies
`all-jobs-pass` step in Github CI. This new job will be used as the
required check in branch protection rules for `main` and will only have
2 possible outcomes, fail or success. This ensures that the rule that
blocks/allows PR merge will be respected at all times.

## **Related issues**

Fixes:

## **Manual testing steps**

- Verify that PR is unblocked when all jobs in `ci.yml` passes (PR
unblocked)
- Verify that PR is blocked when any jobs fail in `ci.yml` (PR blocked)
- Verify that PR is unblocked when a job is skipped in `ci.yml` (PR
unblocked)

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->
- With passing steps -
https://github.com/MetaMask/metamask-mobile/actions/runs/10783045121/job/29904159950
- With skipped step -
https://github.com/MetaMask/metamask-mobile/actions/runs/10783060054/job/29904204109
- With failed step -
https://github.com/MetaMask/metamask-mobile/actions/runs/10783103928/job/29904330493
## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
Cal-L authored Sep 10, 2024
1 parent 0fc20d7 commit 72576bb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,22 @@ jobs:
js-bundle-size-check,
sonar-cloud-quality-gate-status,
]
outputs:
ALL_JOBS_PASSED: ${{ steps.jobs-passed-status.outputs.ALL_JOBS_PASSED }}
steps:
- run: echo "Great success!"
- name: Set jobs passed status
id: jobs-passed-status
run: echo "ALL_JOBS_PASSED=true" >> "$GITHUB_OUTPUT"
check-all-jobs-pass:
name: Check all jobs pass
runs-on: ubuntu-20.04
needs: all-jobs-pass
if: always()
steps:
- run: |
if [[ "${{ needs.all-jobs-pass.outputs.ALL_JOBS_PASSED }}" == "true" ]]; then
echo "All jobs passed. Unblock PR."
else
echo "All jobs passed step skipped. Block PR."
exit 1
fi

0 comments on commit 72576bb

Please sign in to comment.