-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new Github Action workflow to verify CI checks
- Loading branch information
1 parent
f4cdbeb
commit edac29c
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This workflow runs on pull requests when they are opened, synchronized, or reopened. | ||
# It performs the following actions: | ||
# 1. Removes the 'ci-passed' label when a pull request is synchronized or reopened, | ||
# indicating that changes have been pushed, and CI needs to rerun. | ||
# 2. Polls every 5 minutes to check if all CI checks have passed. | ||
# 3. Adds the 'ci-passed' label to the pull request if all CI checks pass successfully. | ||
|
||
name: Check CI Completion | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
permissions: | ||
checks: read | ||
pull-requests: write | ||
|
||
jobs: | ||
remove_ci_passed_label: | ||
if: github.event_name == 'pull_request' && (github.event.action == 'synchronize' || github.event.action == 'reopened') | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Remove 'ci-passed' Label on PR Synchronize | ||
run: | | ||
echo "Removing 'ci-passed' label as new changes have been pushed." | ||
gh pr edit ${{ github.event.pull_request.number }} --remove-label "ci-passed" --repo $GITHUB_REPOSITORY || echo "Label not present" | ||
check_ci_status: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Check if all CI checks passed | ||
uses: wechuli/allcheckspassed@0b68b3b7d92e595bcbdea0c860d05605720cf479 | ||
with: | ||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
delay: '5' | ||
retries: '7' | ||
polling_interval: '5' | ||
|
||
- name: Add 'ci-passed' label | ||
if: success() | ||
run: | | ||
gh pr edit ${{ github.event.pull_request.number }} --add-label "ci-passed" --repo $GITHUB_REPOSITORY |