Clear Commits #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Clear Commits | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Target branch to clean' | |
| required: true | |
| default: 'X' | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch }} | |
| fetch-depth: 0 | |
| - name: Squash all commits | |
| run: | | |
| git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
| git config --local user.name "${{ github.actor }}" | |
| ROOT=$(git rev-list --max-parents=0 HEAD) | |
| git reset --soft "$ROOT" | |
| git commit --amend -m "Rebuild" | |
| git push -f origin ${{ inputs.branch }} | |
| - name: Cleanup Workflow | |
| uses: Mattraks/delete-workflow-runs@main | |
| with: | |
| retain_days: 0 | |
| keep_minimum_runs: 0 |