feat(workspace): choose which repositories and people practice reviews cover #5876
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: | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| jobs: | |
| validate-title: | |
| name: "Validate title" | |
| 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 pnpm + Node.js | |
| uses: ./.github/actions/setup-pnpm-node | |
| - name: "Install dependencies" | |
| run: pnpm install --frozen-lockfile | |
| - name: "Validate PR title with commitlint" | |
| id: commitlint | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| run: | | |
| # Use commitlint to validate PR title (single source of truth) | |
| echo "$PR_TITLE" | pnpm exec commitlint 2>&1 | tee /tmp/commitlint-output.txt | |
| exit_code=${PIPESTATUS[1]} | |
| # Capture output for the comment | |
| { | |
| echo 'error_message<<EOF' | |
| cat /tmp/commitlint-output.txt | |
| echo 'EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| exit "$exit_code" | |
| continue-on-error: true | |
| - name: "Comment on PR with validation error" | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 | |
| if: steps.commitlint.outcome == 'failure' | |
| with: | |
| header: pr-title-lint-error | |
| message: | | |
| ## ❌ PR Title Validation Failed | |
| ``` | |
| ${{ steps.commitlint.outputs.error_message }} | |
| ``` | |
| > 📖 See [CONTRIBUTING.md](https://github.com/ls1intum/Hephaestus/blob/main/CONTRIBUTING.md) for commit message guidelines. | |
| - name: "Remove error comment on success" | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 | |
| 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" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| if: github.event.action == 'opened' | |
| steps: | |
| - uses: technote-space/assign-author@9558557c5c4816f38bd06176fbc324ba14bb3160 # v1 | |
| labeler: | |
| name: "Apply labels" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5 | |
| with: | |
| configuration-path: .github/labeler.yml | |
| # v8 is the first release to run on Node 24, which is what executes the TypeScript below. | |
| - name: "Apply size and semantic labels" | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| script: | | |
| const { default: labelPullRequest } = await import( | |
| `${process.env.GITHUB_WORKSPACE}/.github/scripts/label-pr.ts` | |
| ) | |
| await labelPullRequest({github, context}) |