From 5f83661297f2bbc23c0c224abc2eb85cc07343f3 Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Mon, 28 Oct 2024 20:33:45 -0500 Subject: [PATCH 1/2] ci(commit-check): only check pull requests Only run this for pull requests. If we run it on push it will try to comment on a PR that does not exist. Signed-off-by: Randolph Sapp --- .github/workflows/commit-check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 69ec75366..2073ab414 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -1,7 +1,6 @@ --- name: Commit Check on: - push: pull_request: branches: ['master'] From 8c411f339acf1c3285f0227bbc0b2c91848d1d3e Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Mon, 28 Oct 2024 19:52:02 -0500 Subject: [PATCH 2/2] ci(commit-check): add permissions Add the required permissions for the worker to comment the build results on the PR being submitted. Add the GITHUB_TOKEN to the env so it can actually authenticate with the endpoint. Signed-off-by: Randolph Sapp --- .github/workflows/commit-check.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 2073ab414..72c194123 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -8,6 +8,10 @@ jobs: commit-check: name: Commit Check runs-on: ubuntu-latest + permissions: + contents: read + issues: write + pull-requests: write steps: - name: Checkout @@ -15,7 +19,10 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - uses: commit-check/commit-check-action@v1 + - name: Check commit + uses: commit-check/commit-check-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: message: true author-name: true