Cleanup #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cleanup | |
on: | |
workflow_run: | |
workflows: | |
- SYCL Pre Commit | |
- SYCL Nightly | |
- SYCL Post Commit | |
types: [completed] | |
jobs: | |
cleanup: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.payload.workflow_run.id, | |
}); | |
let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name.match(/^sycl_(linux|windows)_/); | |
}); | |
matchArtifacts.forEach(async (artifact) => { | |
await github.rest.actions.deleteArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: artifact.id | |
}); | |
}); |