Final Check #1
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: Final Check | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [ final_check ] | |
permissions: | |
contents: read | |
jobs: | |
final-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 | |
echo "deb [arch=amd64] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
sudo apt update | |
sudo apt install gh -y | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get PR number | |
id: get_pr_number | |
run: echo "PR_NUMBER=${{ github.event.client_payload.pull_request_number }}" >> $GITHUB_ENV | |
- name: Check Dummy and CI statuses | |
id: check-status | |
run: | | |
PR_NUMBER=${{ env.PR_NUMBER }} | |
DUMMY_STATUS=$(gh pr checks $PR_NUMBER | grep 'Dummy / build' | awk '{print $2}') | |
CI_STATUS=$(gh pr checks $PR_NUMBER | grep 'CI / build' | awk '{print $2}') | |
if [[ "$DUMMY_STATUS" == "success" ]] || [[ "$CI_STATUS" == "success" ]]; then | |
echo "One or both checks have passed." | |
echo "status=success" >> $GITHUB_ENV | |
else | |
echo "Both checks failed." | |
echo "status=failure" >> $GITHUB_ENV | |
fi | |
- name: Set final status success | |
if: env.status == 'success' | |
run: echo "Final status is success" | |
continue-on-error: true | |
- name: Set final status failure | |
if: env.status == 'failure' | |
run: exit 1 |