.github/workflows/cleanup-on-create.yaml #221
Workflow file for this run
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
# This workflow will run upon repository creation and clean up | |
# all files that are not strictly required to build an AEM Live project | |
# but that we use to develop the project template. This includes this | |
# particular workflow file. | |
on: | |
create: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: write | |
# only run if commit message is "Initial commit" on main branch | |
if: ${{ github.event_name == 'workflow_dispatch' || ( github.ref == 'refs/heads/main' && !(contains(github.event, 'head_commit') || github.event.head_commit.message == 'Initial commit' )) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Remove Helper Files | |
run: | | |
rm -rf \ | |
.github/workflows/cleanup-on-create.yaml \ | |
CHANGELOG.md | |
- name: Initialize README | |
# replace {repo} and {owner} with the actual values | |
run: | | |
sed -i.bak "s/{repo}/$(basename ${{ github.repository }})/g" README.md | |
sed -i.bak "s/{owner}/$(dirname ${{ github.repository }})/g" README.md | |
- name: Initialize Pull Request Template | |
run: | | |
sed -i.bak "s/{repo}/$(basename ${{ github.repository }})/g" .github/pull_request_template.md | |
sed -i.bak "s/{owner}/$(dirname ${{ github.repository }})/g" .github/pull_request_template.md | |
# commit back to the repository | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "AEM Bot" | |
git add . | |
git commit -m "chore: cleanup repository template" | |
git push |