generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (50 loc) · 1.92 KB
/
cleanup-on-create.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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 "[email protected]"
git config --local user.name "Helix Bot"
git add .
git commit -m "chore: cleanup repository template"
git push