chore(OVH): delete environment when it gets tear down - #441
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the OVH deployment reusable workflow to better reflect deploy vs teardown activity and attempts to clean up GitHub “Environments” metadata after a teardown so the deployments/environments UI doesn’t retain stale preview environments.
Changes:
- Add a dynamic job name in the reusable OVH workflow to clearly indicate Deploying vs Tearing down.
- Add a teardown-only step that calls the GitHub REST API to delete the corresponding environment.
- Expand permissions for the
cleanupjob indeploy.ymlto support the new teardown behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/ovh.yaml | Adds dynamic job naming and a teardown step intended to delete the GitHub Environment via REST API. |
| .github/workflows/deploy.yml | Adds explicit job permissions for the cleanup/teardown reusable-workflow invocation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Deleting environment | ||
| if: ${{ inputs.action == 'teardown' && inputs.target != 'www' }} | ||
| env: | ||
| ENVIRONMENT_NAME: ${{ inputs.environment_name }} | ||
| uses: actions/github-script@v9 | ||
| with: | ||
| script: | | ||
| const environment = process.env.ENVIRONMENT_NAME; | ||
|
|
||
| try { | ||
|
|
||
| await github.rest.repos.deleteAnEnvironment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| environment_name: environment, | ||
| }); |
| permissions: | ||
| contents: read | ||
| deployments: write | ||
| actions: write |
5b858d7 to
6e7b9a5
Compare
|
Hmmm I was under the impression that I have set a dedicated PAT from @mixxxbot, I will grant it access once my access is sorted, as requested on Zulip. |
|
Added @mixxxbot as admin on the project, should be good to go now! |
Correctly clean up the active environment view: https://github.com/mixxxdj/website/deployments