|
29 | 29 | does_pull_request_exist: ${{ steps.pr_exists.outputs.does_pull_request_exist }} |
30 | 30 | pr_number: ${{ steps.pr_exists.outputs.pr_number }} |
31 | 31 | skip_trivy_package: ${{ steps.skip_trivy.outputs.skip_trivy_package }} |
| 32 | + deploy_proxy: ${{ steps.deploy_proxy.outputs.deploy_proxy }} |
32 | 33 | steps: |
33 | 34 | - name: "Checkout code" |
34 | 35 | uses: actions/checkout@v5 |
|
87 | 88 | else |
88 | 89 | echo "skip_trivy_package=false" >> $GITHUB_OUTPUT |
89 | 90 | fi |
| 91 | + - name: "Determine if proxy should be deployed" |
| 92 | + id: deploy_proxy |
| 93 | + env: |
| 94 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 95 | + PR_NUMBER: ${{ steps.pr_exists.outputs.pr_number }} |
| 96 | + run: | |
| 97 | + if [[ -z "$PR_NUMBER" ]]; then |
| 98 | + echo "No pull request detected; proxy deployment will run." |
| 99 | + echo "deploy_proxy=true" >> $GITHUB_OUTPUT |
| 100 | + exit 0 |
| 101 | + fi |
| 102 | +
|
| 103 | + labels=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name') |
| 104 | + echo "Labels on PR #$PR_NUMBER: $labels" |
| 105 | +
|
| 106 | + if echo "$labels" | grep -Fxq 'deploy-proxy'; then |
| 107 | + echo "deploy_proxy=true" >> $GITHUB_OUTPUT |
| 108 | + else |
| 109 | + echo "deploy_proxy=false" >> $GITHUB_OUTPUT |
| 110 | + fi |
90 | 111 | - name: "List variables" |
91 | 112 | run: | |
92 | 113 | export BUILD_DATETIME_LONDON="${{ steps.variables.outputs.build_datetime_london }}" |
@@ -141,6 +162,7 @@ jobs: |
141 | 162 | terraform_version: "${{ needs.metadata.outputs.terraform_version }}" |
142 | 163 | version: "${{ needs.metadata.outputs.version }}" |
143 | 164 | pr_number: "${{ needs.metadata.outputs.pr_number }}" |
| 165 | + deploy_proxy: "${{ needs.metadata.outputs.deploy_proxy }}" |
144 | 166 | secrets: inherit |
145 | 167 | acceptance-stage: # Recommended maximum execution time is 10 minutes |
146 | 168 | name: "Acceptance stage" |
|
0 commit comments