-
Github action supports a delete trigger to kick off workflows. It is very useful for cleaning up resources deployed via temporary deployments. In the same way that the e.g. on:
delete:
branches:
- feature/* Would only trigger actions based on deletions of branches matching the Thanks for reading! |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 8 replies
-
Hi @logyball thank you for your feedback. I agree this would be a nice improvement. I have added this to our internal backlog for the team to prioritize. |
Beta Was this translation helpful? Give feedback.
-
Please done this feature. I need it :D |
Beta Was this translation helpful? Give feedback.
-
I need this feature too. |
Beta Was this translation helpful? Give feedback.
-
Yes, this would be ideal! Just wondering where on the roadmap this enhancement is? @chrispat |
Beta Was this translation helpful? Give feedback.
-
has this being done already? 🙏 |
Beta Was this translation helpful? Give feedback.
-
I also need this! |
Beta Was this translation helpful? Give feedback.
-
Also it is currently hard to discover that The json schema should reject any object within the delete |
Beta Was this translation helpful? Give feedback.
-
I am using GHES 3.5. I have worked around this by declaring an name: Branch Deployment Cleanup Pipeline
on: delete
jobs:
destroy:
if: |
github.event.ref_type =='branch' &&
startswith(github.event.ref, '<prefix>') If these two conditions are not met (misnamed branches, tags), it will result in this: |
Beta Was this translation helpful? Give feedback.
-
But the workflow run still is present in the history. It may confuse when you delete a lot of Pull Request branches |
Beta Was this translation helpful? Give feedback.
-
I also need this feature and if-statement is not working for me. I need to trigger workflow on the deletion branch with a specific name, but it's skipped every time
also tried this one, but it's skipped everytime too: if: startsWith(github.event.ref, 'refs/heads/sc-') |
Beta Was this translation helpful? Give feedback.
-
I would also suggest removing the limitation where |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi @Howu48! Could you please share your configuration of the job? I tested this feature in the non-Enterprise version of GitHub and it did not work as expected. name: TestOnDelete
on:
delete:
branches:
- 'test-*'
jobs:
test:
runs-on: ubuntu-latest
... Using this configuration each time I delete a branch - GitHub runs a new action, but in my case, I need to run the action only if delete a special branch, for example, "test-1". Solution with the condition in a job works well, but it generates a lot of skipped actions. if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'test-') |
Beta Was this translation helpful? Give feedback.
-
Are there any updates? |
Beta Was this translation helpful? Give feedback.
-
also including |
Beta Was this translation helpful? Give feedback.
-
Looking forward to it. |
Beta Was this translation helpful? Give feedback.
Hi @logyball thank you for your feedback.
I agree this would be a nice improvement. I have added this to our internal backlog for the team to prioritize.