|
| 1 | +name: Chore |
| 2 | +on: |
| 3 | + pull_request_target: # zizmor: ignore[dangerous-triggers] no PR code executed |
| 4 | + branches: [main] |
| 5 | + types: [opened, reopened, edited, synchronize] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + check-pr-title: |
| 15 | + name: Check PR Title |
| 16 | + if: github.event_name == 'pull_request' |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + pull-requests: write |
| 21 | + steps: |
| 22 | + - name: Check valid conventional commit message |
| 23 | + id: lint |
| 24 | + uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 |
| 25 | + with: |
| 26 | + subjectPattern: ^[A-Z].+[^. ]$ # subject must start with uppercase letter and may not end with a dot/space |
| 27 | + env: |
| 28 | + GITHUB_TOKEN: ${{ github.token }} |
| 29 | + - name: Post comment about invalid PR title |
| 30 | + if: failure() |
| 31 | + uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 |
| 32 | + with: |
| 33 | + header: conventional-commit-pr-title |
| 34 | + message: | |
| 35 | + Thank you for opening this pull request! 👋🏼 |
| 36 | +
|
| 37 | + This repository requires pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. |
| 38 | +
|
| 39 | + <details><summary><b>Details</b></summary> |
| 40 | +
|
| 41 | + ``` |
| 42 | + ${{ steps.lint.outputs.error_message }} |
| 43 | + ``` |
| 44 | +
|
| 45 | + ${{ github.event.pull_request.user.login == 'dependabot[bot]' && '*Note: Please manually adjust this for the first few PRs created by dependabot.* It will learn the pattern over time.' || '' }} |
| 46 | +
|
| 47 | + </details> |
| 48 | + - name: Delete comment about invalid PR title |
| 49 | + if: success() |
| 50 | + uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 |
| 51 | + with: |
| 52 | + header: conventional-commit-pr-title |
| 53 | + delete: true |
| 54 | + |
| 55 | + release-drafter: |
| 56 | + name: ${{ github.event_name == 'pull_request' && 'Assign Labels' || 'Draft Release' }} |
| 57 | + runs-on: ubuntu-latest |
| 58 | + permissions: |
| 59 | + contents: write |
| 60 | + pull-requests: write |
| 61 | + steps: |
| 62 | + - name: ${{ github.event_name == 'pull_request' && 'Assign labels' || 'Update release draft' }} |
| 63 | + uses: release-drafter/release-drafter@6db134d15f3909ccc9eefd369f02bd1e9cffdf97 # v6.2.0 |
| 64 | + with: |
| 65 | + disable-releaser: ${{ github.event_name == 'pull_request' }} |
| 66 | + disable-autolabeler: ${{ github.event_name == 'push' }} |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ github.token }} |
0 commit comments