Issue with close_pull_request_job job
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Hi Azure SWA community,
I customized the github workflow for deploying to Azure SWA by updating the triggers a little bit. The idea behind is that we would like to have `dev`, `staging` and `main` environments set up for our team to QA. The engineer work flow when adding a new feature would be opening a new PR against dev first.
Additionally, we would also have [Pull Request preview environments](https://learn.microsoft.com/en-us/azure/static-web-apps/review-publish-pull-requests) against `dev` env because we can demonstrate the changes to the team before we merge any new code change into `dev`
Since Azure SWA standard plan only supports [10 preview environments](https://learn.microsoft.com/en-us/azure/static-web-apps/quotas), we added in the `close_pull_request_job` job to delete the preview environment. However, whenever we close a PR against the `dev` branch by merging it in. The `close_pull_request_job` job always failed by giving this error:
Here is our github workflow yml:
```
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
- dev
- staging
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
- dev
- staging
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: true
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Install OIDC Client from Core Package
run: npm install @actions/core@1.6.0 @actions/http-client
- name: Get Id Token
uses: actions/github-script@v6
id: id-token
with:
script: |
const coredemo = require('@actions/core')
return await coredemo.getIDToken()
result-encoding: string
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_PROUD_COAST_086F09710 }}
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/client" # App source code path
api_location: "api" # Api source code path - optional
output_location: "build" # Built app content directory - optional
github_id_token: ${{ steps.id-token.outputs.result }}
production_branch: "main"
###### End of Repository/Build Configurations ######
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-close
cancel-in-progress: true
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_PROUD_COAST_086F09710 }}
action: "close"
```
I search the doc and it says that ` The lifecycle of a pre-production environment is tied to the pull request. Once the pull request is closed, the pre-production environment is automatically deleted.` from this [document](https://learn.microsoft.com/en-us/azure/static-web-apps/review-publish-pull-requests#prerequisites). I am not sure where this workflow went wrong. Any advice is appreciated!
Best
An engineer.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.