Repository navigation
firmware: add owner OTA research code (held) #1626
This file contains hidden or 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: UI author approval | ||
|
Check warning on line 1 in .github/workflows/ui-author-approval.yml
|
||
| on: | ||
| pull_request_target: | ||
| branches: [main] | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| issue_comment: | ||
| types: [created, edited, deleted] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| statuses: write | ||
| env: | ||
| GIT_HTTP_LOW_SPEED_LIMIT: "1000" | ||
| GIT_HTTP_LOW_SPEED_TIME: "60" | ||
| jobs: | ||
| resolve: | ||
| if: github.event_name == 'pull_request_target' || github.event.issue.pull_request | ||
| permissions: | ||
| pull-requests: read | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 2 | ||
| outputs: | ||
| sha: ${{ steps.head.outputs.sha }} | ||
| steps: | ||
| - uses: actions/github-script@v9 | ||
| id: head | ||
| with: | ||
| script: | | ||
| const pull_number = context.payload.pull_request?.number || context.payload.issue.number; | ||
| const {data: pr} = await github.rest.pulls.get({...context.repo, pull_number}); | ||
| if (!/^[a-f0-9]{40}$/.test(pr.head.sha)) throw new Error('Invalid head SHA'); | ||
| core.setOutput('sha', pr.head.sha); | ||
| guard: | ||
| needs: resolve | ||
| concurrency: | ||
| group: ui-author-approval-${{ needs.resolve.outputs.sha }} | ||
| cancel-in-progress: false | ||
| if: github.event_name == 'pull_request_target' || github.event.issue.pull_request | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| # Never check out or execute the PR head with these credentials. | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.workflow_sha }} | ||
| persist-credentials: false | ||
| - uses: actions/github-script@v9 | ||
| with: | ||
| script: | | ||
| await require('./.github/scripts/ui-author-approval.cjs')({github, context, headSha: process.env.HEAD_SHA}); | ||
| env: | ||
| HEAD_SHA: ${{ needs.resolve.outputs.sha }} | ||