diff --git a/README.md b/README.md index 8c57771..cbf9a6d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/entrypoint.sh b/entrypoint.sh index 8139556..92154f4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 @@ -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}