create.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: "Create"
  2. # The workflow will run only when the "Use this template" button is used
  3. on:
  4. create:
  5. jobs:
  6. create:
  7. # We only run this action when the repository isn't the template repository. References:
  8. # - https://docs.github.com/en/actions/learn-github-actions/contexts
  9. # - https://docs.github.com/en/actions/learn-github-actions/expressions
  10. if: ${{ !github.event.repository.is_template }}
  11. permissions: "write-all"
  12. runs-on: "ubuntu-latest"
  13. steps:
  14. - name: "Check out the repo"
  15. uses: "actions/checkout@v4"
  16. - name: "Update package.json"
  17. env:
  18. GITHUB_REPOSITORY_DESCRIPTION: ${{ github.event.repository.description }}
  19. run:
  20. ./.github/scripts/rename.sh "$GITHUB_REPOSITORY" "$GITHUB_REPOSITORY_OWNER" "$GITHUB_REPOSITORY_DESCRIPTION"
  21. - name: "Add rename summary"
  22. run: |
  23. echo "## Commit result" >> $GITHUB_STEP_SUMMARY
  24. echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
  25. - name: "Remove files not needed in the user's copy of the template"
  26. run: |
  27. rm -f "./.github/FUNDING.yml"
  28. rm -f "./.github/scripts/rename.sh"
  29. rm -f "./.github/workflows/create.yml"
  30. - name: "Add remove summary"
  31. run: |
  32. echo "## Remove result" >> $GITHUB_STEP_SUMMARY
  33. echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
  34. - name: "Update commit"
  35. uses: "stefanzweifel/git-auto-commit-action@v4"
  36. with:
  37. commit_message: "feat: initial commit"
  38. commit_options: "--amend"
  39. push_options: "--force"
  40. skip_fetch: true
  41. - name: "Add commit summary"
  42. run: |
  43. echo "## Commit result" >> $GITHUB_STEP_SUMMARY
  44. echo "✅ Passed" >> $GITHUB_STEP_SUMMARY