mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 14:03:33 +09:00
## Description Tired of deployment messages https://github.com/orgs/community/discussions/36919 ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
# https://github.com/orgs/community/discussions/36919
|
|
name: Delete github deployments
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
sha:
|
|
type: string
|
|
required: true
|
|
|
|
permissions:
|
|
deployments: write
|
|
|
|
jobs:
|
|
delete_github_deployments:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ always() }}
|
|
steps:
|
|
- name: Delete Previous deployments
|
|
uses: actions/github-script@v7
|
|
env:
|
|
SHA_HEAD: ${{ inputs.sha }}
|
|
with:
|
|
script: |
|
|
const { SHA_HEAD } = process.env
|
|
|
|
const deployments = await github.rest.repos.listDeployments({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
sha: SHA_HEAD
|
|
});
|
|
await Promise.all(
|
|
deployments.data.map(async (deployment) => {
|
|
await github.rest.repos.createDeploymentStatus({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
deployment_id: deployment.id,
|
|
state: 'inactive'
|
|
});
|
|
return github.rest.repos.deleteDeployment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
deployment_id: deployment.id
|
|
});
|
|
})
|
|
);
|