Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update workflow check-conventional-commits #962

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/conventional-commits-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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 = [];

Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -29,15 +34,14 @@ jobs:
- if: ${{ github.event_name == 'pull_request_target' }}
run: |
set -ex

node .github/workflows/conventional-commits-lint.js pr <<EOF
${{ toJSON(github.event) }}
EOF
TMP_FILE=$(mktemp)
echo "${EVENT}" > "$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 <<EOF
${{ toJSON(github.event) }}
EOF
TMP_FILE=$(mktemp)
echo "${EVENT}" > "$TMP_FILE"
node .github/workflows/conventional-commits-lint.js push "${TMP_FILE}"