This GitHub Action (written in JavaScript) wraps the GitHub Release API to allow you to leverage GitHub Actions to delete draft releases.
Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.
No outputs are available in this version.
On every push it deletes any release marked as a draft:
on:
push:
name: Delete Draft Releases
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Delete drafts
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}To delete drafts older than a certain amount of time you can use the threshold input
on:
push:
name: Delete Draft Releases older than 5 days
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Delete drafts
uses: hugo19941994/delete-draft-releases@v1.0.0
with:
threshold: 5d
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}The minimum amount of time is 1 second
- seconds
s - minutes
mmin - hours
hhr - days
d - weeks
wwk - months
mo - years
yyr
The scripts and documentation in this project are released under the MIT License