Skip to content

Commit 4fbe599

Browse files
committed
Format documentation commit in GitHub actions
The commit message provides the SHA1 of the current commit and an ID for the build, now both on Travis and GitHub actions. Fixes espressif#74.
1 parent 4fb9820 commit 4fbe599

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: doxy_gen_and_deploy.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ if [[ -z "${TRAVIS_BUILD_DIR}" ]]; then
4444
export BUILD_DIR=${GITHUB_WORKSPACE}
4545
export AUTH=${GITHUB_ACTOR}:${GH_REPO_TOKEN}
4646
export REPO_SLUG=${GITHUB_REPOSITORY}
47+
export COMMIT_SHA1=${GITHUB_SHA}
48+
export BUILD_ID="GitHub Actions run: ${GITHUB_RUN_ID}"
4749
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
4850
export IS_PULL=1
4951
fi
5052
else
5153
export BUILD_DIR=${TRAVIS_BUILD_DIR}
5254
export AUTH=${GH_REPO_TOKEN}
5355
export REPO_SLUG=${TRAVIS_REPO_SLUG}
56+
export COMMIT_SHA1=${TRAVIS_COMMIT}
57+
export BUILD_ID="Travis build: ${TRAVIS_BUILD_NUMBER}"
5458
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
5559
export IS_PULL=1
5660
fi
@@ -78,7 +82,7 @@ cd ${REPO_NAME}
7882
git config --global push.default simple
7983
# Pretend to be an user called Doxygen CI.
8084
git config user.name "Doxygen CI"
81-
git config user.email "[email protected]"
85+
git config user.email "ci-arduino@invalid"
8286

8387
# Remove everything currently in the gh-pages branch.
8488
# GitHub is smart enough to know which files have changed and which files have
@@ -171,7 +175,9 @@ if [ -d "html" ] && [ -f "html/index.html" ]; then
171175
# Commit the added files with a title and description containing the Travis CI
172176
# build number and the GitHub commit reference that issued this build.
173177
echo 'Git committing'
174-
git commit -m "Deploy code docs to GitHub Pages Travis build: ${TRAVIS_BUILD_NUMBER}" -m "Commit: ${TRAVIS_COMMIT}"
178+
git commit \
179+
-m "Deploy docs to GitHub Pages from commit ${COMMIT_SHA1:0:10}" \
180+
-m "Commit: ${COMMIT_SHA1}"$'\n'"${BUILD_ID}"
175181

176182
# Force push to the remote gh-pages branch.
177183
# The ouput is redirected to /dev/null to hide any sensitive credential data

0 commit comments

Comments
 (0)