-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEV-238922] Add check title validation and trigger sonar
- Loading branch information
1 parent
7151b02
commit d4d392a
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Check PR Title | ||
on: | ||
pull_request: | ||
types: [opened, edited, reopened] | ||
env: | ||
GH_TOKEN: ${{ secrets.GIT_TOKEN_SECRET }} | ||
GIT_TOKEN_SECRET: ${{ secrets.GIT_TOKEN_SECRET }} | ||
OWNER: ${{ github.repository_owner }} | ||
REPO: ${{ github.event.repository.name }} | ||
jobs: | ||
check_pr_title: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
run: git clone -q https://${GIT_TOKEN_SECRET}@github.com/${OWNER}/${REPO}.git --depth=2 | ||
- name: Check Jira ID on PR title | ||
run: | | ||
cd ${REPO} || exit | ||
pr_id=$(jq --raw-output .pull_request.number "${GITHUB_EVENT_PATH}") | ||
pr_author=$(jq --raw-output .pull_request.user.login "${GITHUB_EVENT_PATH}") | ||
pr_title=$(jq --raw-output .pull_request.title "${GITHUB_EVENT_PATH}") | ||
if [[ ${pr_title} =~ ^\[DEVAUTOM-[0-9]+\] ]]; then | ||
echo -e "(√) Title '${pr_title}' is ok!" | ||
exit 0 | ||
else | ||
echo -e "(x) Title '${pr_title}' is not ok!" | ||
gh issue comment ${pr_id} --body ":x: @${pr_author} this pull request title '${pr_title}' is incorrect! | ||
Please insert your Jira ID issue on title according the follow convention: | ||
'[DEVAUTOM-12345] <PR title>'" | ||
exit 1 | ||
fi | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Trigger Sonar | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
env: | ||
GH_TOKEN: ${{ secrets.GIT_TOKEN_SECRET }} | ||
BAMBOO_TOKEN_SECRET: ${{ secrets.BAMBOO_TOKEN_SECRET }} | ||
GITHUB_TOKEN_SECRET: ${{ secrets.GIT_TOKEN_SECRET }} | ||
GITHUB_REPO_OWNER: ${{ github.repository_owner }} | ||
GITHUB_REPO: ${{ github.event.repository.name }} | ||
GITHUB_PR_ID: ${{ github.event.number }} | ||
jobs: | ||
trigger_sonar: | ||
if: | | ||
github.repository == 'TrustlyInc/trustly-ios' && | ||
github.event.pull_request.mergeable_status != 'dirty' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
run: git clone -q https://${GITHUB_TOKEN_SECRET}@github.com/${GITHUB_REPO_OWNER}/${GITHUB_REPO}.git --depth=2 | ||
- name: Trigger Bamboo Pipeline - SonarQube Pull Request Analysis | ||
run: | | ||
cd "${GITHUB_REPO}" || exit | ||
echo -e "Github PR ID : ${GITHUB_PR_ID}" | ||
echo -e "Github repository: ${GITHUB_REPO}" | ||
echo -e "Trigger Bamboo Pipeline" | ||
curl --request POST \ | ||
"https://bamboo.paywithmybank.com/rest/api/latest/queue/CAS-SATAPR?bamboo.GITHUB_PR_ID=${GITHUB_PR_ID}" --data "stage&executeAllStages" \ | ||
--header "Authorization: Bearer ${BAMBOO_TOKEN_SECRET}" | ||
shell: bash |