From fa07b82d7b86a8df3553e4fd55cdfdbab971440d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lohrer?= <1091954+joerglohrer@users.noreply.github.com> Date: Tue, 12 Mar 2024 06:58:15 +0100 Subject: [PATCH] Create initialize-repo.yml --- .github/workflows/initialize-repo.yml | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/initialize-repo.yml diff --git a/.github/workflows/initialize-repo.yml b/.github/workflows/initialize-repo.yml new file mode 100644 index 0000000..e740c73 --- /dev/null +++ b/.github/workflows/initialize-repo.yml @@ -0,0 +1,31 @@ +name: Initialize repo from template +on: [push] +jobs: + init: + name: Reinitialize repository + runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. + contents: write + steps: + - name: Exit for template repository + shell: bash + run: | + curl --silent -X GET \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/json" \ + $GITHUB_API_URL/repos/$GITHUB_REPOSITORY \ + | jq --exit-status '.is_template == false' + + - uses: actions/checkout@v2 + + - name: Initialize + shell: bash + run: ./.init-repo.sh + env: + REPO_NAME: ${{ github.event.repository.name }} + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Initialized repo"