|
1 | 1 | # CI: proto and commitlint; fan-out Go (fmt, lint, unit-tests) || UI (ui-lint, ui-test); |
2 | 2 | # then build (gitops, gitops-server). On tag: image, chart, goreleaser. |
3 | 3 | # |
4 | | -# Flow: conventional-commits (if !tag) -> proto (make proto, git diff) in parallel with |
5 | | -# ui-lint, ui-test. Then go-fmt, go-lint, go-unit-tests (need proto). Then build |
| 4 | +# Flow: pr-title-lint (if PR; else skipped) -> conventional-commits (if !tag; |
| 5 | +# runs when pr-title-lint success or skipped) -> proto (make proto, git diff) |
| 6 | +# in parallel with ui-lint, ui-test. Then go-fmt, |
| 7 | +# go-lint, go-unit-tests (need proto). Then build |
6 | 8 | # (make gitops, make gitops-server). Tag jobs (image, chart, goreleaser) need build. |
7 | 9 | # No make clean (each run is a fresh checkout). |
8 | 10 | # |
|
31 | 33 | PYTHON_VERSION: "3.12" |
32 | 34 |
|
33 | 35 | jobs: |
| 36 | + pr-title-lint: |
| 37 | + name: Validate PR title |
| 38 | + runs-on: ubuntu-latest |
| 39 | + if: github.event_name == 'pull_request' |
| 40 | + permissions: |
| 41 | + pull-requests: write |
| 42 | + steps: |
| 43 | + - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 |
| 44 | + id: lint_pr_title |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + |
| 48 | + - uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 |
| 49 | + if: always() && (steps.lint_pr_title.outputs.error_message != null) |
| 50 | + with: |
| 51 | + header: pr-title-lint-error |
| 52 | + message: | |
| 53 | + Hey there and thank you for opening this pull request! :wave: |
| 54 | +
|
| 55 | + We require pull request titles to follow the |
| 56 | + [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) |
| 57 | + and it looks like your proposed title needs to be adjusted. |
| 58 | +
|
| 59 | + We use the pull request title in automated release changelog updates, and would like our |
| 60 | + changelogs to look nice. |
| 61 | +
|
| 62 | + Details: |
| 63 | +
|
| 64 | + ``` |
| 65 | + ${{ steps.lint_pr_title.outputs.error_message }} |
| 66 | + ``` |
| 67 | +
|
| 68 | + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} |
| 69 | + uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 |
| 70 | + with: |
| 71 | + header: pr-title-lint-error |
| 72 | + delete: true |
| 73 | + |
34 | 74 | conventional-commits: |
35 | 75 | name: Conventional Commits |
| 76 | + needs: [pr-title-lint] |
36 | 77 | runs-on: ubuntu-latest |
37 | | - if: "!startsWith(github.ref, 'refs/tags/')" |
| 78 | + if: always() && (needs.pr-title-lint.result == 'success' || needs.pr-title-lint.result == 'skipped') && !startsWith(github.ref, 'refs/tags/') |
38 | 79 | steps: |
39 | 80 | - uses: actions/checkout@v4 |
40 | 81 | with: |
|
0 commit comments