2022-10-04 10:21:35 +00:00
|
|
|
name: "Create"
|
|
|
|
|
2023-03-04 10:31:24 +00:00
|
|
|
# The workflow will run only when the "Use this template" button is used
|
2022-10-04 10:21:35 +00:00
|
|
|
on:
|
|
|
|
create:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
create:
|
2023-03-04 10:31:24 +00:00
|
|
|
# We only run this action when the repository isn't the template repository. References:
|
|
|
|
# - https://docs.github.com/en/actions/learn-github-actions/contexts
|
|
|
|
# - https://docs.github.com/en/actions/learn-github-actions/expressions
|
2022-10-04 10:21:35 +00:00
|
|
|
if: ${{ !github.event.repository.is_template }}
|
|
|
|
permissions: "write-all"
|
|
|
|
runs-on: "ubuntu-latest"
|
|
|
|
steps:
|
|
|
|
- name: "Check out the repo"
|
|
|
|
uses: "actions/checkout@v3"
|
|
|
|
|
|
|
|
- name: "Update package.json"
|
2023-03-03 10:13:09 +00:00
|
|
|
env:
|
|
|
|
GITHUB_REPOSITORY_DESCRIPTION: ${{ github.event.repository.description }}
|
|
|
|
run:
|
|
|
|
./.github/scripts/rename.sh "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY_OWNER" "$GITHUB_REPOSITORY_DESCRIPTION"
|
2022-10-04 10:21:35 +00:00
|
|
|
|
|
|
|
- name: "Add rename summary"
|
|
|
|
run: |
|
2023-03-04 10:31:24 +00:00
|
|
|
echo "## Commit result" >> $GITHUB_STEP_SUMMARY
|
2022-10-04 10:21:35 +00:00
|
|
|
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
|
|
|
|
|
2023-03-17 22:52:33 +00:00
|
|
|
- name: "Remove files not needed in the user's copy of the template"
|
2023-03-03 17:34:55 +00:00
|
|
|
run: |
|
2023-03-17 22:52:33 +00:00
|
|
|
rm -f "./.github/FUNDING.yml"
|
2023-03-04 10:31:24 +00:00
|
|
|
rm -f "./.github/scripts/rename.sh"
|
|
|
|
rm -f "./.github/workflows/create.yml"
|
2023-03-03 17:34:55 +00:00
|
|
|
|
|
|
|
- name: "Add remove summary"
|
|
|
|
run: |
|
2023-03-04 10:31:24 +00:00
|
|
|
echo "## Remove result" >> $GITHUB_STEP_SUMMARY
|
2023-03-03 17:34:55 +00:00
|
|
|
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
|
|
|
|
|
2022-10-04 10:21:35 +00:00
|
|
|
- name: "Update commit"
|
|
|
|
uses: "stefanzweifel/git-auto-commit-action@v4"
|
|
|
|
with:
|
|
|
|
commit_message: "feat: initial commit"
|
|
|
|
commit_options: "--amend"
|
|
|
|
push_options: "--force"
|
|
|
|
skip_fetch: true
|
|
|
|
|
|
|
|
- name: "Add commit summary"
|
|
|
|
run: |
|
2023-03-04 10:31:24 +00:00
|
|
|
echo "## Commit result" >> $GITHUB_STEP_SUMMARY
|
2022-10-04 10:21:35 +00:00
|
|
|
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
|