feat: add Noden #1046
Workflow file for this run
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: Auto-merge MDX Entry PRs | |
| on: | |
| pull_request_target: | |
| branches: ['main'] | |
| types: [opened, reopened, synchronize, edited, labeled, unlabeled, ready_for_review] | |
| workflow_run: | |
| workflows: ['PR Review'] | |
| types: [completed] | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'Optional pull request number to process. Leave empty to scan all open PRs.' | |
| required: false | |
| type: string | |
| concurrency: | |
| group: auto-merge-mdx-${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number || inputs.pr_number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| automerge: | |
| name: Auto-merge | |
| if: github.repository_owner == 'thedaviddias' | |
| permissions: | |
| actions: read | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout trusted base | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| ref: main | |
| - name: Capture trusted base SHA | |
| id: base | |
| run: | | |
| trusted_base_sha="$(git rev-parse HEAD)" | |
| if [[ ! "$trusted_base_sha" =~ ^[0-9a-f]{40}$ ]]; then | |
| exit 1 | |
| fi | |
| echo "sha=$trusted_base_sha" >> "$GITHUB_OUTPUT" | |
| - name: Install | |
| uses: ./.github/actions/install | |
| - name: Resolve trusted event context | |
| id: context | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| EVENT_PATH: ${{ github.event_path }} | |
| run: | | |
| pnpm exec tsx scripts/pr-backfill-dry-run.ts \ | |
| --derive-event-context "$EVENT_PATH" "$EVENT_NAME" >> "$GITHUB_OUTPUT" | |
| - name: Validate, label, and merge eligible PR | |
| if: steps.context.outputs.should_process == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GOOGLE_WEB_RISK_API_KEY: ${{ secrets.GOOGLE_WEB_RISK_API_KEY }} | |
| PR_NUMBER: ${{ steps.context.outputs.pr_number }} | |
| SCAN_ALL: ${{ steps.context.outputs.scan_all }} | |
| SUBMISSION_ASSESSMENT_SIGNING_SECRET: ${{ secrets.SUBMISSION_ASSESSMENT_SIGNING_SECRET }} | |
| TRUSTED_BASE_SHA: ${{ steps.base.outputs.sha }} | |
| run: | | |
| if [ -n "$PR_NUMBER" ]; then | |
| pnpm exec tsx scripts/pr-backfill-dry-run.ts --pr "$PR_NUMBER" | |
| elif [ "$SCAN_ALL" = 'true' ]; then | |
| pnpm exec tsx scripts/pr-backfill-dry-run.ts --concurrency 4 | |
| else | |
| exit 1 | |
| fi | |
| - name: Report failed merge | |
| if: failure() && steps.context.outputs.pr_number != '' | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| env: | |
| PR_NUMBER: ${{ steps.context.outputs.pr_number }} | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| const prNumber = Number(process.env.PR_NUMBER) | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: | |
| 'Trusted PR automation failed while validating, labeling, or merging this PR. Check the Auto-merge MDX Entry PRs workflow logs for the exact failure.' | |
| }) |