[DEV-12345] DO NOT MERGE - TESTING #33
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
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" | |
response=$(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}" \ | |
--write-out "%{http_code}" \ | |
--silent \ | |
--output /dev/null) | |
if [ "${response}" -eq 200 ]; then | |
echo "Pipeline triggered successfully." | |
else | |
echo "Failed to trigger pipeline. HTTP status code: ${response}" | |
fi | |
shell: bash |