diff --git a/.github/workflows/clean-up.yml b/.github/workflows/clean-up.yml new file mode 100644 index 0000000..4dd8dab --- /dev/null +++ b/.github/workflows/clean-up.yml @@ -0,0 +1,50 @@ +name: Delete old workflow runs +on: + schedule: + - cron: '0 0 * * *' + +jobs: + del_runs: + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + id-token: write + steps: + - name: Delete workflow runs + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 30 + keep_minimum_runs: 6 + + # Points to a recent commit instead of `main` to avoid supply chain attacks. (The latest tag is very old.) + - name: 🎟 Get GitHub App token + uses: actions/create-github-app-token@v1 + id: get-token + with: + app-id: ${{ secrets.GH_APP_ID }} + private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} + + - name: Delete workflow runs for current repo + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 7 + keep_minimum_runs: 6 + + - name: Delete deployment + uses: strumwolf/delete-deployment-environment@v2.3.0 + with: + token: ${{ steps.get-token.outputs.token }} + environment: Preview + onlyRemoveDeployments: true + + - name: Delete MAIN deployment + uses: strumwolf/delete-deployment-environment@v2.3.0 + with: + token: ${{ steps.get-token.outputs.token }} + environment: Production + onlyRemoveDeployments: true \ No newline at end of file diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index beadec9..b924fe3 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -24,36 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - # Points to a recent commit instead of `main` to avoid supply chain attacks. (The latest tag is very old.) - - name: 🎟 Get GitHub App token - uses: actions/create-github-app-token@v1 - id: get-token - with: - app-id: ${{ secrets.GH_APP_ID }} - private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} - - - name: Delete workflow runs for current repo - uses: Mattraks/delete-workflow-runs@v2 - with: - token: ${{ github.token }} - repository: ${{ github.repository }} - retain_days: 7 - keep_minimum_runs: 6 - - - name: Delete deployment - uses: strumwolf/delete-deployment-environment@v2.3.0 - with: - token: ${{ steps.get-token.outputs.token }} - environment: Preview - onlyRemoveDeployments: true - - - name: Delete MAIN deployment - uses: strumwolf/delete-deployment-environment@v2.3.0 - with: - token: ${{ steps.get-token.outputs.token }} - environment: Production - onlyRemoveDeployments: true - + - name: Checkout repository uses: actions/checkout@v2