Skip to content

firmware: add owner OTA research code (held) #1626

firmware: add owner OTA research code (held)

firmware: add owner OTA research code (held) #1626

name: UI author approval

Check warning on line 1 in .github/workflows/ui-author-approval.yml

View workflow run for this annotation

GitHub Actions / UI author approval

Workflow execution policy warning (evaluate mode)

On December 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
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 }}