Skip to content

Commit

Permalink
Merge pull request #34 from andstor/develop
Browse files Browse the repository at this point in the history
v3.2.0
  • Loading branch information
andstor authored Apr 18, 2020
2 parents 9f5596b + afa6cb5 commit 37c634a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions 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.2.0] - 2020-04-18
### Added
- Create the destination branch (based on the default branch) if it doesn't exists.

## [3.1.1] - 2020-04-01
### Added
- Add automatic updating of major version tag on release.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ The following input variable options can/must be configured:
|`dst_path`|Optional|The destination path to copy the file(s) or folder(s) to. For example `/wiki/` or `path/to/index.md`. |`src_path`|
|`dst_owner`|Required|The name of the owner of the repository to push to. For example `andstor`.||
|`dst_repo_name`|Required|The name of the repository to push to. For example `copycat-action`.||
|`src_branch`|Optional|The branch name of the source repository.|`master`|
|`dst_branch`|Optional|The branch name of the destination repository.|`master`|
|`src_branch`|Optional|The name of the branch in source repository to clone from.|`master`|
|`dst_branch`|Optional|The name of the branch in the destination repository to push to. If the branch doesn't exists, the branch will be created based on the default branch.|`master`|
|`clean`|Optional|Set to `true` if the `dst_path` should be emptied before copying.|`false`|
|`file_filter`|Optional|A simple [pattern](https://www.gnu.org/software/findutils/manual/html_mono/find.html#Shell-Pattern-Matching) for filtering files to be copied. Acts on file basename. For example `*.sh`.||
|`filter`|Optional|A glob pattern for filtering files to be copied. Acts on file paths. For example `**/!(*.*)`.||
Expand Down
15 changes: 11 additions & 4 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-04-01
# @date 2020-04-18
# @license MIT
# @version 3.1.0
# @version 3.2.0

set -o pipefail

Expand Down Expand Up @@ -112,8 +112,15 @@ fi

git clone --branch ${DST_BRANCH} --single-branch --depth 1 https://${PERSONAL_TOKEN}@github.com/${DST_REPO}.git
if [ "$?" -ne 0 ]; then
echo >&2 "Cloning '$DST_REPO' failed"
exit 1
echo >&2 "Cloning branch '$DST_BRANCH' in '$DST_REPO' failed"
echo >&2 "Falling back to default branch"
git clone --single-branch --depth 1 https://${PERSONAL_TOKEN}@github.com/${DST_REPO}.git
echo >&2 "Creating branch '$DST_BRANCH'"
git checkout -b ${DST_BRANCH}
if [ "$?" -ne 0 ]; then
echo >&2 "Creation of Branch '$DST_BRANCH' failed"
exit 1
fi
fi

if [ "$CLEAN" = "true" ]; then
Expand Down

0 comments on commit 37c634a

Please sign in to comment.