Skip to content

Commit

Permalink
chore: GH action to check PR title (V2) (#3738)
Browse files Browse the repository at this point in the history
* Added GH action to check PR title

Signed-off-by: Elena Kubantseva <elena.kubantseva@broadcom.com>

* Fix typo in comment

Signed-off-by: Elena Kubantseva <elena.kubantseva@broadcom.com>

---------

Signed-off-by: Elena Kubantseva <elena.kubantseva@broadcom.com>
  • Loading branch information
arxioly authored Sep 3, 2024
1 parent 8d8ada8 commit 5422e4d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: PR Checker

on:
pull_request_target:
branches: [ v2.x.x, v3.x.x ]
types: [opened, reopened, edited]

jobs:
PRInstructions:
name: PR Instructions
runs-on: ubuntu-latest
if: github.event.pull_request.user.login != 'zowe-robot'

steps:
- name: Check PR title
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: ${{ github.event.pull_request.title }}
PR: ${{ github.event.pull_request.html_url }}
run: |
for prefix in 'fix:' 'feat:' 'docs:' 'refactor:' 'chore:'; do
case $TITLE in
"$prefix"*)
echo "PR title starts with '$prefix'"
exit 0
esac
done
echo "PR title doesn't start with any of allowed prefixes"
gh pr edit $PR --add-label 'invalid'
gh pr comment $PR --body 'It looks like PR title does not contain one of the required prefixes: `fix:`, `feat:`, `docs:`, `refactor:`, `chore:`. Please add one of the prefixes based on the type of your changes by following our [contributing guidelines](https://github.com/zowe/api-layer/blob/v3.x.x/CONTRIBUTING.md#type)'

0 comments on commit 5422e4d

Please sign in to comment.