From 28518520f79b2baf3ca656f604b3941920b2c496 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:35:18 +0800 Subject: [PATCH] Create delete-artifacts.yml --- .../delete-artifacts.yml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/name: Delete Artifacts on: workflow_dispatch: jobs: delete-artifacts: runs-on: ubuntu-latest steps: - name: Delete Old Artifacts uses: actions/delete-artifacts.yml diff --git a/.github/workflows/name: Delete Artifacts on: workflow_dispatch: jobs: delete-artifacts: runs-on: ubuntu-latest steps: - name: Delete Old Artifacts uses: actions/delete-artifacts.yml b/.github/workflows/name: Delete Artifacts on: workflow_dispatch: jobs: delete-artifacts: runs-on: ubuntu-latest steps: - name: Delete Old Artifacts uses: actions/delete-artifacts.yml new file mode 100644 index 000000000..ac1cd2360 --- /dev/null +++ b/.github/workflows/name: Delete Artifacts on: workflow_dispatch: jobs: delete-artifacts: runs-on: ubuntu-latest steps: - name: Delete Old Artifacts uses: actions/delete-artifacts.yml @@ -0,0 +1,25 @@ +name: Delete Artifacts +on: + workflow_dispatch: + +jobs: + delete-artifacts: + runs-on: ubuntu-latest + steps: + - name: Delete Old Artifacts + uses: actions/github-script@v6 + id: artifact + with: + script: | + const res = await github.rest.actions.listArtifactsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + }) + res.data.artifacts + .forEach(({ id }) => { + github.rest.actions.deleteArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: id, + }) + })