File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed
Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 3636 echo "INSTANCE=$PROXYGEN_API_NAME-PR-$PR_NUMBER" >> $GITHUB_ENV
3737 echo "SANDBOX_TAG=pr$PR_NUMBER" >> $GITHUB_ENV
3838 echo "MTLS_NAME=notify-supplier-mtls-pr$PR_NUMBER" >> $GITHUB_ENV
39-
4039 fi
4140
4241 - name : Install Proxygen client
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ name: Deploy proxy to internal-dev
22
33on :
44 workflow_dispatch :
5- inputs :
6- pr_number :
7- description : " PR Number for PR Environment "
8- required : false
5+ push :
6+ branches :
7+ - " ** "
8+ - ' !master '
99
1010permissions :
1111 contents : read
1717 env :
1818 PROXYGEN_API_NAME : notify-supplier-api
1919 PROXYGEN_PRIVATE_KEY : ${{ secrets.PROXYGEN_PRIVATE_KEY }}
20- PR_NUMBER : ${{ github.event.inputs.pr_number }}
2120 steps :
2221 - name : Checkout
2322 uses : actions/checkout@v4
3130 run : npm ci
3231 shell : bash
3332
33+ - name : " Check if pull request exists for this branch"
34+ id : pr_exists
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+ run : |
38+ branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
39+ echo "Current branch is '$branch_name'"
40+
41+ pr_json=$(gh pr list --head "$branch_name" --state open --json number --limit 1)
42+ pr_number=$(echo "$pr_json" | jq -r '.[0].number // empty')
43+
44+ if [[ -n "$pr_number" ]]; then
45+ echo "Pull request exists: #$pr_number"
46+ echo "does_pull_request_exist=true" >> $GITHUB_OUTPUT
47+ echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
48+ else
49+ echo "Pull request doesn't exist"
50+ echo "does_pull_request_exist=false" >> $GITHUB_OUTPUT
51+ echo "pr_number=" >> $GITHUB_OUTPUT
52+ fi
53+
3454 - name : Setup Proxy Name and target
3555 shell : bash
56+ env :
57+ PR_NUMBER : ${{ steps.pr_exists.outputs.pr_number }}
3658 run : |
3759 if [ -z $PR_NUMBER ]
3860 then
6587 - name : Build internal dev oas
6688 working-directory : .
6789 shell : bash
90+ env :
91+ PR_NUMBER : ${{ steps.pr_exists.outputs.pr_number }}
6892 run : |
6993 if [ -z $PR_NUMBER ]
7094 then
You can’t perform that action at this time.
0 commit comments