.github/workflows/cleanup-on-create.yaml #1
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 | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: write | |
# only run if commit message is "Initial commit" on main branch | |
if: ${{ github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Initial commit' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Uninstall dependencies | |
run: | | |
npm uninstall --save-dev semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/exec | |
- name: Remove Helper Files | |
run: | | |
rm -rf \ | |
.github/workflows/cleanup-on-create.yaml \ | |
.github/workflows/semantic-release.yaml \ | |
.releaserc.cjs \ | |
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 "helix@adobe.com" | |
git config --local user.name "Helix Bot" | |
git add . | |
git commit -m "chore: cleanup repository template" | |
git push |