--- #104
This file contains 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
# GitHub Actions Workflow responsible for cleaning up the template repository from | |
# the template-specific files and configurations. This workflow is supposed to be triggered automatically | |
# when a new template-based repository has been created. | |
# | |
# Adapted from https://github.com/cortinico/kotlin-android-template/blob/master/.github/workflows/cleanup.yaml | |
name: Template Cleanup | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
template-cleanup: | |
name: Template Cleanup | |
runs-on: ubuntu-latest | |
if: github.event.repository.name != 'detekt-custom-rule-template' | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Cleanup project | |
- name: Cleanup | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
owner=$(echo $GITHUB_REPOSITORY | cut -d/ -f1 | tr '[:upper:]' '[:lower:]') | |
name=$(echo $GITHUB_REPOSITORY | cut -d/ -f2 | tr '[:upper:]' '[:lower:]' | tr -d "-" | tr -d ".") | |
./change_package_name.sh com.github.${owner,,}.${name,,} "$(echo $GITHUB_REPOSITORY | cut -d/ -f2)" | |
# Push changes | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
branch: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} |