Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete the deployment history of a repository in GitHub

How to delete the deployment history of a repository in GitHub to show only the active?

enter image description here

like image 535
EhsaN Avatar asked Jan 29 '26 04:01

EhsaN


2 Answers

You can create a github action to automatically delete deployments on the next commit (from this reply).

For example, if there is a deployment to github-pages, you can add the following entry to the workflow

jobs:
  cleanup:
    runs-on: ubuntu-latest
    permissions: write-all

    steps:
      - name: 🗑 Delete deployment
        uses: strumwolf/delete-deployment-environment@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          environment: github-pages
          onlyRemoveDeployments: true

This action will delete all existing deployments on the specified environment (github-pages)

This action should be run before the deploy, so that there will be no record of the deploy in the environment, and the deploy that will run afterwards will create only 1 record.

To make sure that the deploy runs after cleaning, you can add it to your deploy process:

needs: cleanup
like image 84
M É‘ k s Avatar answered Jan 30 '26 20:01

M É‘ k s


  1. On GitHub.com, navigate to the main page of the repository.
  2. Under your repository name, click Settings.
  3. In the left sidebar, click Environments.
  4. Next to the environment that you want to delete, click delete. Click I understand, delete this environment.
like image 23
Aditya Goel Avatar answered Jan 30 '26 20:01

Aditya Goel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!