Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Usage:
- uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: '' #optional defaults to master
BRANCH_NAME: '' #optional defaults to "master"
COMMIT_MESSAGE: '' #optional defaults to "Automated publish: ${timestamp} ${GITHUB_SHA}"
```

If you can get away with only ever writing new files, instead of updating them, you won’t regret it ;) Every time you update a file you retain the history of the file. Over time this can become quite large and contain a lot of duplicate data, even when using Git LFS as described below. The only way to garbage collect this historical data is to use a [hefty Java program called BFG](https://rtyley.github.io/bfg-repo-cleaner/) to re-write the history.
Expand Down
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ if [ -z "${BRANCH_NAME}" ]; then
export BRANCH_NAME=master
fi

if [ -z "${COMMIT_MESSAGE}" ]; then
timestamp=$(date -u)
export COMMIT_MESSAGE="Automated publish: ${timestamp} ${GITHUB_SHA}"
fi

# initialize git
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config http.sslVerify false
Expand All @@ -25,7 +30,6 @@ git lfs install
# publish any new files
git checkout ${BRANCH_NAME}
git add -A
timestamp=$(date -u)
git commit -m "Automated publish: ${timestamp} ${GITHUB_SHA}" || exit 0
git commit -m "${COMMIT_MESSAGE}" || exit 0
git pull --rebase publisher ${BRANCH_NAME}
git push publisher ${BRANCH_NAME}