diff --git a/.github/workflows/sycl_cleanup.yml b/.github/workflows/sycl_cleanup.yml new file mode 100644 index 0000000000000..e75fc6a21f144 --- /dev/null +++ b/.github/workflows/sycl_cleanup.yml @@ -0,0 +1,32 @@ +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 + }); + });