Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
usulpro committed May 29, 2024
1 parent b5a5e35 commit 4380610
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/new-repo.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
name: Save Repository ID to .env

on:
repository_dispatch:
types: [repository_template_created]
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
save_repo_id:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

save_repo_id:
name: Save Repository ID
needs: get_current_step
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 0 }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: main

Expand All @@ -27,4 +49,4 @@ jobs:
git config --global user.email '[email protected]'
git add .env
git commit -m "Add repository ID to .env"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}" main
git push origin main

0 comments on commit 4380610

Please sign in to comment.