-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for main and master branch (PR #7)
- Adds command to check master/main branch name. - Print the name of the default branch. Co-authored-by: Manoel Campos <[email protected]>
- Loading branch information
1 parent
f23adc6
commit 23258c9
Showing
1 changed file
with
11 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -20,13 +20,23 @@ git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | ||
|
||
|
||
# Taking care of the fact that GitHub repos can have a default | ||
# branch which can either be named master or main | ||
|
||
default_branch="master" | ||
if ! git show-branch --list $default_branch; then | ||
default_branch="main" | ||
fi | ||
echo "Default branch: $default_branch" | ||
|
||
# Avoids keeping the commit history for the gh-pages branch, | ||
# so that such a branch keeps only the last commit. | ||
# But this slows down the GitHub Pages website build process. | ||
echo "Checking out the gh-pages branch without keeping its history" | ||
git branch -D gh-pages 1>/dev/null 2>/dev/null || true | ||
git log | head -n 1 | cut -d' ' -f2 > /tmp/commit-hash.txt | ||
git checkout -q --orphan gh-pages master 1>/dev/null | ||
git fetch --all | ||
git checkout -q --orphan gh-pages $default_branch 1>/dev/null | ||
|
||
#echo "Checking out the gh-pages branch, keeping its history" | ||
#git checkout master -B gh-pages 1>/dev/null | ||
|