diff --git a/CHANGELOG.md b/CHANGELOG.md index 80f2a13..a9bfdf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org). ## [Unreleased] +## [3.1.0] - 2020-04-01 +### Added +- Input variable `commit_message` for using a custom commit message. + ## [3.0.1] - 2020-03-28 ### Fixed - Fix copying of files with names containing spaces. @@ -26,7 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org). ## 1.0.0 - 2019-07-09 -[Unreleased]: https://github.com/andstor/copycat-action/compare/v3.0.1...HEAD +[Unreleased]: https://github.com/andstor/copycat-action/compare/v3.1.0...HEAD +[3.1.0]: https://github.com/andstor/copycat-action/compare/v3.0.1...v3.1.0 [3.0.1]: https://github.com/andstor/copycat-action/compare/v3.0.0...v3.0.1 [3.0.0]: https://github.com/andstor/copycat-action/compare/v2.0.0...v3.0.0 [2.0.0]: https://github.com/andstor/copycat-action/compare/v1.1.0...v2.0.0 diff --git a/README.md b/README.md index 4334ad0..8c99687 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ The following input variable options can/must be configured: |`exclude`|Optional|A glob pattern for excluding paths. For example `*/tests/*`.|| |`src_wiki`|Optional|Set to `true` if the source repository you want to copy from is the GitHub Wiki.| `false`| |`dst_wiki`|Optional|Set to `true` if the destination repository you want to copy from is the GitHub Wiki.|`false`| +|`commit_message`|Optional|A custom git commit message.|| |`username`|Optional|The GitHub username to associate commits made by this GitHub action.|[`GITHUB_ACTOR`](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables)| |`email`|Optional|The email used for associating commits made by this GitHub action.|[`GITHUB_ACTOR`](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables) `@users.noreply.github.com`| diff --git a/action.yml b/action.yml index 1db8a0a..424ee54 100644 --- a/action.yml +++ b/action.yml @@ -49,6 +49,9 @@ inputs: description: 'Set to true if the destination repository you want to copy from is the GitHub Wiki' required: false default: false + commit_message: + description: 'A custom git commit message.' + required: false username: description: 'The GitHub username to associate commits made by this GitHub action' required: false @@ -72,5 +75,6 @@ runs: - ${{ inputs.exclude }} - ${{ inputs.src_wiki }} - ${{ inputs.dst_wiki }} + - ${{ inputs.commit_message }} - ${{ inputs.username }} - ${{ inputs.email }} diff --git a/entrypoint.sh b/entrypoint.sh index 1bf4f55..00ce482 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,9 @@ #!/bin/bash # # @author André Storhaug -# @date 2020-03-09 +# @date 2020-04-01 # @license MIT -# @version 3.0.0 +# @version 3.1.0 set -o pipefail @@ -22,6 +22,7 @@ FILTER="$INPUT_FILTER" EXCLUDE="$INPUT_EXCLUDE" SRC_WIKI="$INPUT_SRC_WIKI" DST_WIKI="$INPUT_DST_WIKI" +COMMIT_MESSAGE="$INPUT_COMMIT_MESSAGE" USERNAME="$INPUT_USERNAME" EMAIL="$INPUT_EMAIL" @@ -129,10 +130,12 @@ mkdir -p ${DST_REPO_NAME}/${DST_PATH%/*} || exit "$?" cp -rf ${FINAL_SOURCE} ${DST_REPO_NAME}/${DST_PATH} || exit "$?" cd ${DST_REPO_NAME} || exit "$?" -if [ -f "${BASE_PATH}/${FINAL_SOURCE}" ]; then - COMMIT_MESSAGE="Update file in \"${SRC_PATH}\" from \"${GITHUB_REPOSITORY}\"" -else - COMMIT_MESSAGE="Update file(s) \"${SRC_PATH}\" from \"${GITHUB_REPOSITORY}\"" +if [[ -z "${COMMIT_MESSAGE}" ]]; then + if [ -f "${BASE_PATH}/${FINAL_SOURCE}" ]; then + COMMIT_MESSAGE="Update file in \"${SRC_PATH}\" from \"${GITHUB_REPOSITORY}\"" + else + COMMIT_MESSAGE="Update file(s) \"${SRC_PATH}\" from \"${GITHUB_REPOSITORY}\"" + fi fi if [ -z "$(git status --porcelain)" ]; then