Skip to content

Workflow file for this run

name: Save Repository ID to .env
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
if [ -f ./.github/script/STEP ]; then
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
else
echo "current_step=0" >> $GITHUB_OUTPUT
fi
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@v3
with:
ref: main
- name: Print and Save Repository ID
run: |
echo "Repository ID: ${{ github.event.repository.id }}"
echo "REPO_ID=${{ github.event.repository.id }}" > .env
- name: Commit and Push .env
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add .env
git commit -m "Add repository ID to .env"
git push origin main