forked from berkeley-cdss/course-site-quarto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de1e2a0
commit a58f940
Showing
1 changed file
with
7 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
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 | ||
|
@@ -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 |