Skip to content

Commit

Permalink
Deploy tested action.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlovett committed Jul 19, 2024
1 parent de1e2a0 commit a58f940
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/create-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Initialize gh-pages branch
name: Initialize gh-pages branch on repo creation

on:
workflow_dispatch:
create:

permissions:
contents: write

jobs:
setup-gh-pages:
runs-on: ubuntu-latest
Expand All @@ -16,21 +19,14 @@ jobs:
- name: Configure Git
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
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 # make sure all changes are committed before running this!
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
- name: Delete inherited gh-pages branch if it exists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if git ls-remote --exit-code --heads origin gh-pages-inherited; then
git push origin --delete gh-pages-inherited
fi

0 comments on commit a58f940

Please sign in to comment.