Skip to content

Update the URL value in the ROKS URL field in the platform-auth-idp c… #276

Update the URL value in the ROKS URL field in the platform-auth-idp c…

Update the URL value in the ROKS URL field in the platform-auth-idp c… #276

name: Open PR for scripts review
on:
push:
branches:
- scripts-dev
jobs:
open-pr-for-review:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Create PR
id: create_pr
run: |
git checkout scripts-dev
timestamp=$(date +%Y-%m-%d-%H-%M-%S)
message="common service installer automation on $timestamp"
base_branch="scripts-adopter"
branch_to_merge="scripts-dev"
result=$(gh pr list --search "base:scripts-adopter head:scripts-dev is:open")
if [ -z "$result" ]; then
echo "No PR found, creating a new one"
pr_url=$(gh pr create -B $base_branch -H $branch_to_merge --title "Review changes from $branch_to_merge to $base_branch" --body "$message")
pr_number=$(echo "$pr_url" | awk -F'/' '{print $NF}')
echo "new_created=1" >> $GITHUB_OUTPUT
else
echo "PR already exists, skipping gh pr create"
pr_number=$(echo "$result" | awk -F' ' '{print $1}')
echo "new_created=0" >> $GITHUB_OUTPUT
fi
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add label to the PR
if: steps.create_pr.outputs.pr_number != '' && steps.create_pr.outputs.new_created == '1'
run: |
pr_number=$(echo "${{ steps.create_pr.outputs.pr_number }}")
gh pr edit $pr_number --add-label "do-not-merge/hold"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add comment to the PR
if: steps.create_pr.outputs.pr_number != ''
run: |
pr_number=$(echo "${{ steps.create_pr.outputs.pr_number }}")
gh pr comment $pr_number --body "please add label \`ok-to-sync\` and remove label \`do-not-merge/hold\` to merge the PR"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}