Skip to content

Initialize gh-pages branch on repo creation #2

Initialize gh-pages branch on repo creation

Initialize gh-pages branch on repo creation #2

name: Initialize gh-pages branch on repo creation
on:
workflow_dispatch:
create:
permissions:
contents: write
jobs:
setup-gh-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
- name: Create empty gh-pages branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initialising gh-pages branch"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push origin gh-pages