From 30808a075b16452eb1c155dcbb971d6326b5720e Mon Sep 17 00:00:00 2001 From: Etienne Stalmans Date: Wed, 4 Dec 2024 17:25:04 +0100 Subject: [PATCH] chore: update check conventional-commits Update workflow to match other repositories and better handling of github.event format. --- .../workflows/conventional-commits-lint.js | 2 +- .github/workflows/conventional-commits.yml | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/conventional-commits-lint.js b/.github/workflows/conventional-commits-lint.js index 96d6c9828d..976a92b1b4 100644 --- a/.github/workflows/conventional-commits-lint.js +++ b/.github/workflows/conventional-commits-lint.js @@ -17,7 +17,7 @@ const ALLOWED_CONVENTIONAL_COMMIT_PREFIXES = [ ]; const object = process.argv[2]; -const payload = JSON.parse(fs.readFileSync(process.stdin.fd, "utf-8")); +const payload = JSON.parse(fs.readFileSync(process.argv[3], "utf-8")); let validate = []; diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index f91c9b0793..9d22bf585e 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -16,10 +16,15 @@ on: - reopened - ready_for_review +permissions: + contents: read + jobs: check-conventional-commits: runs-on: ubuntu-latest - + if: github.actor != 'dependabot[bot]' # skip for dependabot PRs + env: + EVENT: ${{ toJSON(github.event) }} steps: - uses: actions/checkout@v4 with: @@ -30,14 +35,14 @@ jobs: run: | set -ex - node .github/workflows/conventional-commits-lint.js pr < "$TMP_FILE" + node .github/workflows/conventional-commits-lint.js pr "${TMP_FILE}" - if: ${{ github.event_name == 'push' }} run: | set -ex - node .github/workflows/conventional-commits-lint.js push < "$TMP_FILE" + node .github/workflows/conventional-commits-lint.js push "${TMP_FILE}"