Skip to content

fix/new-repo workflow #3

fix/new-repo workflow

fix/new-repo workflow #3

Workflow file for this run

name: Save repository info
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
save_repo_info:
name: Save repository info to .env file
if: >-
${{ !github.event.repository.is_template }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
- name: Print and save repository info
run: |
echo "Repository ID: ${{ github.event.repository.id }}"
echo "REPO_ID=${{ github.event.repository.id }}" >> apps/sanity/.env
echo "REPO_ID=${{ github.event.repository.id }}" >> apps/storyblok/.env
echo "Repository Name: ${{ github.repository }}"
echo "REPO_NAME=${{ github.repository }}" >> apps/sanity/.env
echo "REPO_NAME=${{ github.repository }}" >> apps/storyblok/.env
- name: Commit, push, and remove GitHub Actions workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.event.repository.owner.login }}@users.noreply.github.com"
rm -rf .github/workflows
git add .
git commit -m "Add repository info to .env and remove GitHub Actions workflows"
git push origin main