Initialize gh-pages branch on repo creation #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |