Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

fixup workflows

fixup workflows #2

---
name: Branch Cleanup 🍃
on:
workflow_call:
secrets:
GITHUB_TOKEN:

Check failure on line 7 in .github/workflows/branch-cleanup.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/branch-cleanup.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
description: |
Github token with write access to repository
required: false
inputs:
last-commit-age-days:
description: |
The branch will be removed if the last commit was added to it at least this many days ago.
default: 90
required: false
type: number
jobs:
branch-cleanup:
name: Branch Cleanup 🍃
runs-on: ubuntu-latest
container:
image: ghcr.io/insightsengineering/rstudio:latest
steps:
- name: Setup token 🔑
id: github-token
run: |
if [ "${{ secrets.GITHUB_TOKEN }}" == "" ]; then
echo "GITHUB_TOKEN is empty. Substituting it with GITHUB_TOKEN."
echo "token=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT
else
echo "Using GITHUB_TOKEN."
echo "token=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Checkout Code 🛎
uses: actions/checkout@v4
- name: Cleanup branches 🌿
uses: phpdocker-io/github-actions-delete-abandoned-branches@v1
id: delete-branches
with:
github_token: ${{ steps.github-token.outputs.token }}
last_commit_age_days: ${{ inputs.last-commit-age-days }}
# Additional precaution against deleting main branch.
ignore_branches: main
dry_run: no
- name: Show deleted branches 🌿
run: "echo 'Deleted branches: ${{ steps.delete-branches.outputs.deleted_branches }}'"