Skip to content

fix: pass CI env explicitly in fastfile and testplans - WPB-14950 #14854

fix: pass CI env explicitly in fastfile and testplans - WPB-14950

fix: pass CI env explicitly in fastfile and testplans - WPB-14950 #14854

name: "Semantic Commit Linting of PR titles"
on:
pull_request:
types: [ opened, edited, synchronize ]
# This is what will cancel the workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
semantic-commit-pr-title-lint:
runs-on: ubuntu-latest
if: contains(fromJSON('["opened", "synchronize"]'), github.event.action) || github.event.changes.title != null
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_PR_LABEL: "Fix PR Title 🤦‍♂️"
HEAD: ${{github.head_ref}}
steps:
- name: Checkout
uses: actions/checkout@v4
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
- name: Run Semantic Commint Linter
uses: amannn/action-semantic-pull-request@v5.5.2
with:
# Configure which types are allowed.
# Default: https://github.com/commitizen/conventional-commit-types
types: |
breaking
build
ci
chore
docs
feat
fix
other
perf
refactor
revert
style
test
# For work-in-progress PRs you can typically use draft pull requests
# from Github. However, private repositories on the free plan don't have
# this option and therefore this action allows you to opt-in to using the
# special "[WIP]" prefix to indicate this state. This will avoid the
# validation of the PR title and the pull request checks remain pending.
# Note that a second check will be reported if this is enabled.
wip: true
# When using "Squash and merge" on a PR with only one commit, GitHub
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: false
subjectPattern: ^(.*) - ((WPB-\d+)|(no ticket))$
# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
contains a ticket with "- WPB-XXX" or "- no ticket" for urgent cases.
- name: Add Failure Label
if: failure()
run: |
gh api repos/{owner}/{repo}/labels -f name="${CUSTOM_PR_LABEL}" -f color="FF0000" || true
gh pr edit "${HEAD}" --add-label "${CUSTOM_PR_LABEL}"
- name: Remove Failure Label
if: success()
run: |
gh pr edit "${HEAD}" --remove-label "${CUSTOM_PR_LABEL}"