Status Check Workflow #209
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: Status Check Workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
psha: | |
required: true | |
repository: | |
required: true | |
lsha: | |
required: true | |
jobs: | |
build: | |
name: Check Build | |
runs-on: macos-14 | |
permissions: | |
checks: write | |
statuses: write | |
env: | |
FIN_STATUS: "error" | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- name: Update Check Status | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/statuses/${{ inputs.lsha }} \ | |
-f state='pending' \ | |
-f target_url='https://github.com/Darock-Studio/Darock-Bili/actions/runs/${{ github.run_id }}' \ | |
-f description='Building...' \ | |
-f context='API Status Checker' | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ inputs.repository }} | |
ref: ${{ inputs.psha }} | |
- name: Set Xcode Version | |
run: sudo xcode-select -s /Applications/Xcode_16.app | |
- name: Get Current Time | |
id: current-time | |
run: echo "time=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT | |
- name: Cache Build Caches | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-check-build-cache-${{ steps.current-time.outputs.time }} | |
path: | | |
~/Library/Developer/Xcode/DerivedData | |
restore-keys: | | |
${{ runner.os }}-check-build-cache- | |
- name: Update Status Env | |
run: echo "FIN_STATUS=failure" >> $GITHUB_ENV | |
- name: Build DarockBili App | |
run: | | |
xcodebuild -scheme 'MeowBili' -configuration Release build CODE_SIGN_IDENTITY="" -quiet | |
echo "FIN_STATUS=success" >> $GITHUB_ENV | |
- name: Update Check Status | |
if: always() | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/statuses/${{ inputs.lsha }} \ | |
-f state='${{ env.FIN_STATUS }}' \ | |
-f target_url='https://github.com/Darock-Studio/Darock-Bili/actions/runs/${{ github.run_id }}' \ | |
-f context='API Status Checker' | |