Skip to content

Commit 37c634a

Browse files
authored
Merge pull request #34 from andstor/develop
v3.2.0
2 parents 9f5596b + afa6cb5 commit 37c634a

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org).
66

77
## [Unreleased]
88

9+
## [3.2.0] - 2020-04-18
10+
### Added
11+
- Create the destination branch (based on the default branch) if it doesn't exists.
12+
913
## [3.1.1] - 2020-04-01
1014
### Added
1115
- Add automatic updating of major version tag on release.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ The following input variable options can/must be configured:
3434
|`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`|
3535
|`dst_owner`|Required|The name of the owner of the repository to push to. For example `andstor`.||
3636
|`dst_repo_name`|Required|The name of the repository to push to. For example `copycat-action`.||
37-
|`src_branch`|Optional|The branch name of the source repository.|`master`|
38-
|`dst_branch`|Optional|The branch name of the destination repository.|`master`|
37+
|`src_branch`|Optional|The name of the branch in source repository to clone from.|`master`|
38+
|`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`|
3939
|`clean`|Optional|Set to `true` if the `dst_path` should be emptied before copying.|`false`|
4040
|`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`.||
4141
|`filter`|Optional|A glob pattern for filtering files to be copied. Acts on file paths. For example `**/!(*.*)`.||

entrypoint.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
#
33
# @author André Storhaug <andr3.storhaug@gmail.com>
4-
# @date 2020-04-01
4+
# @date 2020-04-18
55
# @license MIT
6-
# @version 3.1.0
6+
# @version 3.2.0
77

88
set -o pipefail
99

@@ -112,8 +112,15 @@ fi
112112

113113
git clone --branch ${DST_BRANCH} --single-branch --depth 1 https://${PERSONAL_TOKEN}@github.com/${DST_REPO}.git
114114
if [ "$?" -ne 0 ]; then
115-
echo >&2 "Cloning '$DST_REPO' failed"
116-
exit 1
115+
echo >&2 "Cloning branch '$DST_BRANCH' in '$DST_REPO' failed"
116+
echo >&2 "Falling back to default branch"
117+
git clone --single-branch --depth 1 https://${PERSONAL_TOKEN}@github.com/${DST_REPO}.git
118+
echo >&2 "Creating branch '$DST_BRANCH'"
119+
git checkout -b ${DST_BRANCH}
120+
if [ "$?" -ne 0 ]; then
121+
echo >&2 "Creation of Branch '$DST_BRANCH' failed"
122+
exit 1
123+
fi
117124
fi
118125

119126
if [ "$CLEAN" = "true" ]; then

0 commit comments

Comments
 (0)