From b54c6df1984b8f954f70d62d8b784c6ab52319b6 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 21:56:51 -0600 Subject: [PATCH 01/22] ci: Add Conventional Commit Lint --- .github/workflows/commit-lint.yaml | 20 ++++++++++++++++++++ commitlint.config.js | 13 +++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/commit-lint.yaml create mode 100644 commitlint.config.js diff --git a/.github/workflows/commit-lint.yaml b/.github/workflows/commit-lint.yaml new file mode 100644 index 000000000..48ae30e06 --- /dev/null +++ b/.github/workflows/commit-lint.yaml @@ -0,0 +1,20 @@ +--- +name: Lint Commit Messages +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + +permissions: + contents: read + pull-requests: read + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - uses: wagoid/commitlint-github-action@v5.4.5 diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 000000000..367869243 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,13 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'subject-case': [ + 2, + 'never', + [ + 'upper-case', + 'pascal-case', + ] + ] + } +}; From 12f2ccd639924b0e2c8865de2aebc367366ea351 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:30:04 -0600 Subject: [PATCH 02/22] squash: Allow commits targeted to squash --- commitlint.config.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/commitlint.config.js b/commitlint.config.js index 367869243..439e53806 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -8,6 +8,22 @@ module.exports = { 'upper-case', 'pascal-case', ] + ], + 'type-enum': [ + 2, + 'always', + [ + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test' + ] ] } }; From 6eebddbeb7dcf9fafb4cae47f4bf2bb2e824ad40 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:31:07 -0600 Subject: [PATCH 03/22] squash: oops --- commitlint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commitlint.config.js b/commitlint.config.js index 439e53806..1e2ffb534 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -21,6 +21,7 @@ module.exports = { 'perf', 'refactor', 'revert', + 'squash', 'style', 'test' ] From 42581d79a2b9a3b55812943da1af43f1f4496ebb Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:35:36 -0600 Subject: [PATCH 04/22] squash: Lint title --- .github/workflows/commit-lint.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/commit-lint.yaml b/.github/workflows/commit-lint.yaml index 48ae30e06..e7507e73a 100644 --- a/.github/workflows/commit-lint.yaml +++ b/.github/workflows/commit-lint.yaml @@ -1,12 +1,7 @@ --- -name: Lint Commit Messages +name: Linter Conventional Commits on: pull_request: - types: - - opened - - synchronize - - reopened - - edited permissions: contents: read @@ -18,3 +13,10 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - uses: wagoid/commitlint-github-action@v5.4.5 + name: Lint Commit Messages + - uses: amannn/action-semantic-pull-request@v5.4.0 + name: Lint PR Title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + wip: true From 17610f825d1c43b86527fd6d5fc0cbc49841f960 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:45:00 -0600 Subject: [PATCH 05/22] squash: lets do these out of order --- .github/workflows/commit-lint.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/commit-lint.yaml b/.github/workflows/commit-lint.yaml index e7507e73a..bba3c6041 100644 --- a/.github/workflows/commit-lint.yaml +++ b/.github/workflows/commit-lint.yaml @@ -11,12 +11,12 @@ jobs: commitlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 - - uses: wagoid/commitlint-github-action@v5.4.5 - name: Lint Commit Messages - uses: amannn/action-semantic-pull-request@v5.4.0 name: Lint PR Title env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: wip: true + - uses: actions/checkout@v4.1.1 + - uses: wagoid/commitlint-github-action@v5.4.5 + name: Lint Commit Messages From 25bea35e66fe6c105ac5612900af05dd87cf7bff Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:52:19 -0600 Subject: [PATCH 06/22] squash: split up linters --- .github/actions/lint-pr-title.yaml | 65 ++++++++++++++++++++++++++++++ .github/workflows/commit-lint.yaml | 6 --- 2 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 .github/actions/lint-pr-title.yaml diff --git a/.github/actions/lint-pr-title.yaml b/.github/actions/lint-pr-title.yaml new file mode 100644 index 000000000..07c73494d --- /dev/null +++ b/.github/actions/lint-pr-title.yaml @@ -0,0 +1,65 @@ +name: "Lint PR Title" + +# Contents of this PR were copy-paste-modified from +# https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.4.0 + id: lint_pr_title + name: "🤖 Check PR title follows conventional commit spec" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Have to specify all types because `maint` and `rel` aren't defaults + types: | + fix + feat + chore + ci + docs + style + refactor + perf + test + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + - if: always() && (steps.lint_pr_title.outputs.error_message != null) + name: "📝 Add PR comment about using conventional commit spec" + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + message: | + Thank you for contributing to the project! 🎉 + + We require 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. + + Make sure to prepend with `feat:`, `fix:`, or another option in the list below. + + Once you update the title, this workflow will re-run automatically and validate the updated title. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + name: "❌ Delete PR comment after title has been updated" + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true diff --git a/.github/workflows/commit-lint.yaml b/.github/workflows/commit-lint.yaml index bba3c6041..2d4ce3b93 100644 --- a/.github/workflows/commit-lint.yaml +++ b/.github/workflows/commit-lint.yaml @@ -11,12 +11,6 @@ jobs: commitlint: runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 - name: Lint PR Title - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - wip: true - uses: actions/checkout@v4.1.1 - uses: wagoid/commitlint-github-action@v5.4.5 name: Lint Commit Messages From 743f9643c62b6beeab30848888b3a75de3318ab9 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:54:54 -0600 Subject: [PATCH 07/22] squash: relocate files --- .github/actions/lint-pr-title.yaml | 65 ------------------------------ .github/workflows/commit-lint.yaml | 16 -------- 2 files changed, 81 deletions(-) delete mode 100644 .github/actions/lint-pr-title.yaml delete mode 100644 .github/workflows/commit-lint.yaml diff --git a/.github/actions/lint-pr-title.yaml b/.github/actions/lint-pr-title.yaml deleted file mode 100644 index 07c73494d..000000000 --- a/.github/actions/lint-pr-title.yaml +++ /dev/null @@ -1,65 +0,0 @@ -name: "Lint PR Title" - -# Contents of this PR were copy-paste-modified from -# https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml - -on: - pull_request_target: - types: - - opened - - edited - - synchronize - -jobs: - main: - name: Validate PR title - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 - id: lint_pr_title - name: "🤖 Check PR title follows conventional commit spec" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - # Have to specify all types because `maint` and `rel` aren't defaults - types: | - fix - feat - chore - ci - docs - style - refactor - perf - test - # When the previous steps fails, the workflow would stop. By adding this - # condition you can continue the execution with the populated error message. - - if: always() && (steps.lint_pr_title.outputs.error_message != null) - name: "📝 Add PR comment about using conventional commit spec" - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - message: | - Thank you for contributing to the project! 🎉 - - We require 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. - - Make sure to prepend with `feat:`, `fix:`, or another option in the list below. - - Once you update the title, this workflow will re-run automatically and validate the updated title. - - Details: - - ``` - ${{ steps.lint_pr_title.outputs.error_message }} - ``` - - # Delete a previous comment when the issue has been resolved - - if: ${{ steps.lint_pr_title.outputs.error_message == null }} - name: "❌ Delete PR comment after title has been updated" - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - delete: true diff --git a/.github/workflows/commit-lint.yaml b/.github/workflows/commit-lint.yaml deleted file mode 100644 index 2d4ce3b93..000000000 --- a/.github/workflows/commit-lint.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Linter Conventional Commits -on: - pull_request: - -permissions: - contents: read - pull-requests: read - -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - uses: wagoid/commitlint-github-action@v5.4.5 - name: Lint Commit Messages From 5359c0b1749a470f383bc8bc6095be6905d78a81 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 22:55:11 -0600 Subject: [PATCH 08/22] squash: relocate files --- .github/workflows/lint-commit-messages.yaml | 19 ++++++ .github/workflows/lint-pr-title.yaml | 69 +++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 .github/workflows/lint-commit-messages.yaml create mode 100644 .github/workflows/lint-pr-title.yaml diff --git a/.github/workflows/lint-commit-messages.yaml b/.github/workflows/lint-commit-messages.yaml new file mode 100644 index 000000000..3e812f2ea --- /dev/null +++ b/.github/workflows/lint-commit-messages.yaml @@ -0,0 +1,19 @@ +name: "Lint Commit Messages" +on: + pull_request: + +permissions: + contents: read + pull-requests: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request + cancel-in-progress: true # Cancel any previous runs of this workflow + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - uses: wagoid/commitlint-github-action@v5.4.5 + name: Lint Commit Messages diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml new file mode 100644 index 000000000..bbe1d827d --- /dev/null +++ b/.github/workflows/lint-pr-title.yaml @@ -0,0 +1,69 @@ +name: "Lint PR Title" + +# Contents of this PR were copy-paste-modified from +# https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request + cancel-in-progress: true # Cancel any previous runs of this workflow + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.4.0 + id: lint_pr_title + name: "🤖 Check PR title follows conventional commit spec" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Have to specify all types because `maint` and `rel` aren't defaults + types: | + fix + feat + chore + ci + docs + style + refactor + perf + test + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + - if: always() && (steps.lint_pr_title.outputs.error_message != null) + name: "📝 Add PR comment about using conventional commit spec" + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + message: | + Thank you for contributing to the project! 🎉 + + We require 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. + + Make sure to prepend with `feat:`, `fix:`, or another option in the list below. + + Once you update the title, this workflow will re-run automatically and validate the updated title. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + name: "❌ Delete PR comment after title has been updated" + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true From c42a25229f70edbd43e3bfec0ff34126585b11a9 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:02:25 -0600 Subject: [PATCH 09/22] squash: does this work --- .github/workflows/lint-pr-title.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index bbe1d827d..fa8820d7a 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -7,6 +7,7 @@ on: pull_request_target: types: - opened + - reopened - edited - synchronize From f0dee6859ed72e82cfc662b91b46498645ba7910 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:06:59 -0600 Subject: [PATCH 10/22] squash: trigger gosh darn you --- .github/workflows/lint-pr-title.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index fa8820d7a..f344b7508 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -4,12 +4,10 @@ name: "Lint PR Title" # https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml on: - pull_request_target: - types: - - opened - - reopened - - edited - - synchronize + pull_request: + +permissions: + pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request @@ -19,8 +17,6 @@ jobs: main: name: Validate PR title runs-on: ubuntu-latest - permissions: - pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.4.0 id: lint_pr_title From 8d70d90ad6d4af3f16e92f27e03af8aa2234005c Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:09:04 -0600 Subject: [PATCH 11/22] squash: try again --- .github/workflows/lint-pr-title.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index f344b7508..fa3ba2fd3 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -5,6 +5,11 @@ name: "Lint PR Title" on: pull_request: + types: + - opened + - synchronize + - reopened + - edited permissions: pull-requests: write From 2d3a4b4b2550fcf81801232c08abf0a62501fab0 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:12:39 -0600 Subject: [PATCH 12/22] squash: is issue writing required? --- .github/workflows/lint-pr-title.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index fa3ba2fd3..03d0e02e2 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -12,6 +12,7 @@ on: - edited permissions: + issues: write pull-requests: write concurrency: @@ -44,7 +45,7 @@ jobs: # condition you can continue the execution with the populated error message. - if: always() && (steps.lint_pr_title.outputs.error_message != null) name: "📝 Add PR comment about using conventional commit spec" - uses: marocchino/sticky-pull-request-comment@v2 + uses: marocchino/sticky-pull-request-comment@v2.8.0 with: header: pr-title-lint-error message: | @@ -65,7 +66,7 @@ jobs: # Delete a previous comment when the issue has been resolved - if: ${{ steps.lint_pr_title.outputs.error_message == null }} name: "❌ Delete PR comment after title has been updated" - uses: marocchino/sticky-pull-request-comment@v2 + uses: marocchino/sticky-pull-request-comment@v2.8.0 with: header: pr-title-lint-error delete: true From 6a8066c8a04ea2fd8f8514a46ccbfbaa77e91729 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:16:49 -0600 Subject: [PATCH 13/22] squash: read --- .github/workflows/lint-pr-title.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index 03d0e02e2..9702e9049 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -12,7 +12,7 @@ on: - edited permissions: - issues: write + contents: read pull-requests: write concurrency: From 6b1a93d64fd0942a07d86aea50a7bd06fe081b09 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:19:54 -0600 Subject: [PATCH 14/22] squash: force token --- .github/workflows/lint-pr-title.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index 9702e9049..69e6ed4dd 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -47,6 +47,7 @@ jobs: name: "📝 Add PR comment about using conventional commit spec" uses: marocchino/sticky-pull-request-comment@v2.8.0 with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} header: pr-title-lint-error message: | Thank you for contributing to the project! 🎉 @@ -68,5 +69,6 @@ jobs: name: "❌ Delete PR comment after title has been updated" uses: marocchino/sticky-pull-request-comment@v2.8.0 with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} header: pr-title-lint-error delete: true From f4d2804123d5caebdca48c33549b15905095aac0 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:20:50 -0600 Subject: [PATCH 15/22] squash: wrong level --- .github/workflows/lint-pr-title.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index 69e6ed4dd..bfbdfa4b8 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -10,6 +10,12 @@ on: - synchronize - reopened - edited + pull_request_target: + types: + - opened + - synchronize + - reopened + - edited permissions: contents: read From 036e5f238dfb21e081b8e478d22fcac294bc815f Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:25:20 -0600 Subject: [PATCH 16/22] squash: switch to per job permissions --- .github/workflows/lint-pr-title.yaml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index bfbdfa4b8..da0b49c9d 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -10,16 +10,6 @@ on: - synchronize - reopened - edited - pull_request_target: - types: - - opened - - synchronize - - reopened - - edited - -permissions: - contents: read - pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request @@ -29,6 +19,9 @@ jobs: main: name: Validate PR title runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.4.0 id: lint_pr_title From 2d8de9e8412bb056ecdf64f335477148c92497e6 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:28:28 -0600 Subject: [PATCH 17/22] squash: wtf --- .github/workflows/lint-pr-title.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index da0b49c9d..9d945ce1d 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -20,7 +20,7 @@ jobs: name: Validate PR title runs-on: ubuntu-latest permissions: - contents: read + contents: write pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.4.0 From 7acb938f2113c938acc260339d0a368c09c99b93 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:30:09 -0600 Subject: [PATCH 18/22] squash: grasping at straws --- .github/workflows/lint-pr-title.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index 9d945ce1d..52cb9771c 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -17,7 +17,7 @@ concurrency: jobs: main: - name: Validate PR title + name: Lint PR title runs-on: ubuntu-latest permissions: contents: write @@ -45,8 +45,9 @@ jobs: - if: always() && (steps.lint_pr_title.outputs.error_message != null) name: "📝 Add PR comment about using conventional commit spec" uses: marocchino/sticky-pull-request-comment@v2.8.0 - with: + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: header: pr-title-lint-error message: | Thank you for contributing to the project! 🎉 @@ -67,7 +68,8 @@ jobs: - if: ${{ steps.lint_pr_title.outputs.error_message == null }} name: "❌ Delete PR comment after title has been updated" uses: marocchino/sticky-pull-request-comment@v2.8.0 - with: + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: header: pr-title-lint-error delete: true From 5509522f374ce25cd091c3e034c70147aead88e5 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:32:06 -0600 Subject: [PATCH 19/22] squash: wtf --- .github/workflows/lint-pr-title.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index 52cb9771c..7d4543dab 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -21,6 +21,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + issues: write pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.4.0 From 70513072fe0e157cf62629bc31c4f4dd54fb8f22 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:34:42 -0600 Subject: [PATCH 20/22] squash: wth --- .github/workflows/lint-pr-title.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index 7d4543dab..e8e64cd84 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -4,7 +4,7 @@ name: "Lint PR Title" # https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml on: - pull_request: + pull_request_target: types: - opened - synchronize @@ -20,8 +20,7 @@ jobs: name: Lint PR title runs-on: ubuntu-latest permissions: - contents: write - issues: write + contents: read pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.4.0 From 61d5aa1d3d614724e0129f0883a5c3992167ec0a Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:41:00 -0600 Subject: [PATCH 21/22] squash: i give up --- .github/workflows/lint-pr-title.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml index e8e64cd84..499b7a25e 100644 --- a/.github/workflows/lint-pr-title.yaml +++ b/.github/workflows/lint-pr-title.yaml @@ -4,7 +4,7 @@ name: "Lint PR Title" # https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml on: - pull_request_target: + pull_request: types: - opened - synchronize @@ -20,7 +20,7 @@ jobs: name: Lint PR title runs-on: ubuntu-latest permissions: - contents: read + contents: write pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.4.0 @@ -45,8 +45,6 @@ jobs: - if: always() && (steps.lint_pr_title.outputs.error_message != null) name: "📝 Add PR comment about using conventional commit spec" uses: marocchino/sticky-pull-request-comment@v2.8.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: header: pr-title-lint-error message: | @@ -68,8 +66,6 @@ jobs: - if: ${{ steps.lint_pr_title.outputs.error_message == null }} name: "❌ Delete PR comment after title has been updated" uses: marocchino/sticky-pull-request-comment@v2.8.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: header: pr-title-lint-error delete: true From d8cdc792e16db3baf7aa5ea75e4e8945ee5402d2 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 16 Jan 2024 23:48:44 -0600 Subject: [PATCH 22/22] squash: I do not want to deal with permissions --- .github/workflows/lint-commit-messages.yaml | 19 ----- .../workflows/lint-conventional-commits.yaml | 39 ++++++++++ .github/workflows/lint-pr-title.yaml | 71 ------------------- 3 files changed, 39 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/lint-commit-messages.yaml create mode 100644 .github/workflows/lint-conventional-commits.yaml delete mode 100644 .github/workflows/lint-pr-title.yaml diff --git a/.github/workflows/lint-commit-messages.yaml b/.github/workflows/lint-commit-messages.yaml deleted file mode 100644 index 3e812f2ea..000000000 --- a/.github/workflows/lint-commit-messages.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: "Lint Commit Messages" -on: - pull_request: - -permissions: - contents: read - pull-requests: read - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request - cancel-in-progress: true # Cancel any previous runs of this workflow - -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - uses: wagoid/commitlint-github-action@v5.4.5 - name: Lint Commit Messages diff --git a/.github/workflows/lint-conventional-commits.yaml b/.github/workflows/lint-conventional-commits.yaml new file mode 100644 index 000000000..ef226f645 --- /dev/null +++ b/.github/workflows/lint-conventional-commits.yaml @@ -0,0 +1,39 @@ +name: "Lint Conventional Commits" +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request + cancel-in-progress: true # Cancel any previous runs of this workflow + +jobs: + main: + name: Lint Conventional Commits + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@v5.4.0 + name: "🤖 Check PR title follows conventional commit spec" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Have to specify all types because `maint` and `rel` aren't defaults + types: | + fix + feat + chore + ci + docs + style + refactor + perf + test + - uses: actions/checkout@v4.1.1 + - uses: wagoid/commitlint-github-action@v5.4.5 + name: "🤖 Check commit messages follow conventional commit spec" diff --git a/.github/workflows/lint-pr-title.yaml b/.github/workflows/lint-pr-title.yaml deleted file mode 100644 index 499b7a25e..000000000 --- a/.github/workflows/lint-pr-title.yaml +++ /dev/null @@ -1,71 +0,0 @@ -name: "Lint PR Title" - -# Contents of this PR were copy-paste-modified from -# https://github.com/honeycombio/.github/blob/main/.github/workflows/validate-pr-title.yml - -on: - pull_request: - types: - - opened - - synchronize - - reopened - - edited - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request - cancel-in-progress: true # Cancel any previous runs of this workflow - -jobs: - main: - name: Lint PR title - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 - id: lint_pr_title - name: "🤖 Check PR title follows conventional commit spec" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - # Have to specify all types because `maint` and `rel` aren't defaults - types: | - fix - feat - chore - ci - docs - style - refactor - perf - test - # When the previous steps fails, the workflow would stop. By adding this - # condition you can continue the execution with the populated error message. - - if: always() && (steps.lint_pr_title.outputs.error_message != null) - name: "📝 Add PR comment about using conventional commit spec" - uses: marocchino/sticky-pull-request-comment@v2.8.0 - with: - header: pr-title-lint-error - message: | - Thank you for contributing to the project! 🎉 - - We require 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. - - Make sure to prepend with `feat:`, `fix:`, or another option in the list below. - - Once you update the title, this workflow will re-run automatically and validate the updated title. - - Details: - - ``` - ${{ steps.lint_pr_title.outputs.error_message }} - ``` - - # Delete a previous comment when the issue has been resolved - - if: ${{ steps.lint_pr_title.outputs.error_message == null }} - name: "❌ Delete PR comment after title has been updated" - uses: marocchino/sticky-pull-request-comment@v2.8.0 - with: - header: pr-title-lint-error - delete: true