Skip to content

Commit

Permalink
fix(ci): Sanitize PR title by using ENV (#219)
Browse files Browse the repository at this point in the history
As a follow up to #218 we need to further sanitize by using the
intermediate step of using an environment variable to avoid possible
script injection attack.
  • Loading branch information
jwndlng authored May 28, 2024
1 parent a62501e commit ee8ea0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
check:
name: conventional-pr-title:required
runs-on: ubuntu-latest
env:
TITLE: ${{ github.event.pull_request.title }}
steps:
# Conventional commit patterns:
# verb: description
Expand All @@ -31,7 +33,7 @@ jobs:
# scope: refers to the part of code being changed. E.g. " (accounts)" or " (accounts,canisters)"
# !: Indicates that the PR contains a breaking change.
- run: |
if [[ "${{ github.event.pull_request.title }}" =~ ^(feat|fix|chore|build|ci|docs|style|refactor|perf|test)(\([-a-zA-Z0-9,]+\))?\!?\: ]]; then
if [[ "$TITLE" =~ ^(feat|fix|chore|build|ci|docs|style|refactor|perf|test)(\([-a-zA-Z0-9,]+\))?\!?\: ]]; then
echo pass
else
echo "PR title does not match conventions"
Expand Down

0 comments on commit ee8ea0b

Please sign in to comment.