We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26741d6 commit 4669a8cCopy full SHA for 4669a8c
.github/workflows/cleanup_old_deploy.yaml
@@ -0,0 +1,29 @@
1
+name: Cleanup Old Deployments
2
+
3
+on:
4
+ workflow_dispatch: # Umożliwia ręczne uruchomienie
5
6
+jobs:
7
+ cleanup:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Delete old GitHub Pages deployments
11
+ uses: actions/github-script@v6
12
+ with:
13
+ script: |
14
+ const deployments = await github.rest.repos.listDeployments({
15
+ owner: context.repo.owner,
16
+ repo: context.repo.repo,
17
+ environment: 'github-pages'
18
+ });
19
20
+ // Zostaw tylko NAJNOWSZY deployment (indeks 0)
21
+ const toDelete = deployments.data.slice(1);
22
23
+ for (const deployment of toDelete) {
24
+ await github.rest.repos.deleteDeployment({
25
26
27
+ deployment_id: deployment.id
28
29
+ }
0 commit comments