Skip to content

Commit

Permalink
Closes Taskana#2271: fix hooks for github
Browse files Browse the repository at this point in the history
  • Loading branch information
sfrevel committed May 31, 2023
1 parent 4a93269 commit bd9d1f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Release Notes:
- [ ] After integration of the pull request, I verified our [bluemix test environment](http://taskana.mybluemix.net/taskana) is not broken

### Verified by the reviewer:
- [ ] Commit message format → TSK-XXX: Your commit message.
- [ ] Commit message format → (Closes) #<Issue Number>: Your commit message. i.e. Closes #2271: Your commit message.
- [ ] Submitter's update to [documentation](https://taskana.atlassian.net/wiki/spaces/TAS/overview) is sufficient
- [ ] SonarCloud analysis meets our standards
- [ ] Update of the [current release notes](https://taskana.atlassian.net/wiki/spaces/TAS/pages/1281392672/Current+Release+Notes+Taskana) reflects changes
Expand Down
12 changes: 6 additions & 6 deletions qa/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
MSG_FILE=$1
COMMIT_MESSAGE="$(cat $MSG_FILE)"
REGEX='^(TSK-[0-9]+):'
REGEX='^(Close|Closes|Closed|Fix|Fixes|Fixed|Resolve|Resolves|Resolved) #([0-9]+)'
if [[ $COMMIT_MESSAGE =~ $REGEX ]]; then
TICKET=${BASH_REMATCH[1]}
RESULT=$(curl -s https://taskana.atlassian.net/rest/api/3/issue/$TICKET)
if [[ $RESULT =~ "errorMessages" ]]; then
echo -e "\033[0;31mERROR:\033[0m $TICKET is not a valid ticket number"
TICKET=${BASH_REMATCH[2]}
RESULT=$(curl -s https://api.github.com/repos/Taskana/taskana/issues/$TICKET)
if [[ $RESULT =~ "\"message\": \"Not Found\"" ]]; then
echo -e "\033[0;31mERROR:\033[0m $TICKET is not a valid GitHub issue"
exit 1
fi
else
echo -e "\033[0;31mERROR:\033[0m Prefix Git commit messages with the ticket number, e.g. TSK-140: xyz..."
echo -e "\033[0;31mERROR:\033[0m Prefix Git commit messages with the GitHub issue, e.g. Closes #2271: xyz..."
exit 1
fi

0 comments on commit bd9d1f2

Please sign in to comment.