Skip to content

Commit

Permalink
Merge pull request #29 from andstor/feat/commit_message
Browse files Browse the repository at this point in the history
Feat/commit message
  • Loading branch information
andstor authored Mar 31, 2020
2 parents 5c98298 + 86500c7 commit b3e4ce4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`|

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -72,5 +75,6 @@ runs:
- ${{ inputs.exclude }}
- ${{ inputs.src_wiki }}
- ${{ inputs.dst_wiki }}
- ${{ inputs.commit_message }}
- ${{ inputs.username }}
- ${{ inputs.email }}
15 changes: 9 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#
# @author André Storhaug <[email protected]>
# @date 2020-03-09
# @date 2020-04-01
# @license MIT
# @version 3.0.0
# @version 3.1.0

set -o pipefail

Expand All @@ -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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b3e4ce4

Please sign in to comment.