3.1.18.4-prod #70
Workflow file for this run
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: 'Action - Auto Tag Pull Request' | |
on: | |
pull_request: | |
types: [opened, edited, reopened] | |
jobs: | |
add_tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Add tags to PR based on the branch name | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
BRANCH_NAME=${{ github.event.pull_request.head.ref }} | |
if [[ "$BRANCH_NAME" == *"dev"* ]]; then | |
TAG="updated-profile-release-dev" | |
elif [[ "$BRANCH_NAME" == *"prod"* ]]; then | |
TAG="updated-profile-release-prod" | |
fi | |
if [[ -n "$TAG" ]]; then | |
curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
-X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels \ | |
-d "{\"labels\":[\"$TAG\"]}" | |
fi | |
- name: Merge Pull Request | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
MERGE_RESPONSE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
-X PUT \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/merge \ | |
-d '{"commit_message":"Executing Release Build","merge_method":"merge"}') | |
echo "Merge response: $MERGE_RESPONSE" | |
if [[ "$(echo "$MERGE_RESPONSE" | jq -r .merged)" != "true" ]]; then | |
echo "Merge failed: $(echo "$MERGE_RESPONSE" | jq -r .message)" | |
exit 1 | |
fi |