fix(ci): validate the Version PR and preflight its release evidence #6670
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: "PR" | |
| on: | |
| pull_request_target: # zizmor: ignore[dangerous-triggers] No pull-request code is checked out or executed. | |
| branches: [main] | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| validate-title: | |
| name: "Validate title" | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup Node.js and pnpm | |
| uses: ./.github/actions/setup-node-pnpm | |
| with: | |
| install: "frozen" | |
| - name: "Validate PR title with commitlint" | |
| id: commitlint | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| run: | | |
| printf '%s\n' "$PR_TITLE" | pnpm exec commitlint 2>&1 | tee "$RUNNER_TEMP/commitlint-output.txt" | |
| exit_code=${PIPESTATUS[1]} | |
| { | |
| printf '## PR title validation failed\n\n' | |
| sed 's/^/ /' "$RUNNER_TEMP/commitlint-output.txt" | |
| } > "$RUNNER_TEMP/commitlint-comment.md" | |
| exit "$exit_code" | |
| continue-on-error: true | |
| - name: "Comment on PR with validation error" | |
| uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 | |
| if: steps.commitlint.outcome == 'failure' | |
| with: | |
| header: pr-title-lint-error | |
| path: ${{ runner.temp }}/commitlint-comment.md | |
| - name: "Remove error comment on success" | |
| uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 | |
| if: steps.commitlint.outcome == 'success' | |
| with: | |
| header: pr-title-lint-error | |
| delete: true | |
| - name: "Fail workflow if commitlint failed" | |
| if: steps.commitlint.outcome == 'failure' | |
| run: exit 1 | |
| assign-author: | |
| name: "Assign author" | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| if: github.event.action == 'opened' | |
| steps: | |
| - uses: technote-space/assign-author@9558557c5c4816f38bd06176fbc324ba14bb3160 # v1.6.2 | |
| labeler: | |
| name: "Apply labels" | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 | |
| with: | |
| configuration-path: .github/labeler.yml | |
| - name: "Apply size and semantic labels" | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const { default: labelPullRequest } = await import( | |
| `${process.env.GITHUB_WORKSPACE}/.github/scripts/label-pr.ts` | |
| ) | |
| await labelPullRequest({github, context}) |