2

We developed a CI system that runs via Github actions on self-hosted runners.

In order to prevent building unnecessarily, we incorporated a pre-build job that triggers a build only if the commit message has [trigger ci] anywhere.

Now we are facing a slight annoyance: Even if the build job doesn't run, we still have a workflow run show up in the workflow runs list, as expected, but it has basically become a copy of the commit history and very hard to navigate or find which workflows did actually build.

Is there any way that I can delete a workflow run from the workflow runs list conditionally, within the workflow itself? This way, we can keep only the runs that did trigger a build, and delete the ones that skipped building.

starikcetin
  • 1,391
  • 1
  • 16
  • 24
  • 2
    You could use the [Github REST API](https://docs.github.com/en/rest/actions/workflow-runs#delete-workflow-run-logs) directly, or even a [Delete Workflow Runs](https://github.com/marketplace/actions/delete-workflow-runs) action from the marketplace. It's also possible using the GitHub CLI (check [here](https://stackoverflow.com/questions/57927115/delete-a-workflow-from-github-actions)). – GuiFalourd Aug 23 '22 at 11:16
  • Possibly related question: https://stackoverflow.com/questions/57927115/delete-a-workflow-from-github-actions – mhucka Nov 28 '22 at 22:45

0 Answers0