From 358cef57025fcc067d81cd768171cb3f33a28984 Mon Sep 17 00:00:00 2001 From: anarcher Date: Sun, 6 Oct 2019 05:20:52 +0900 Subject: [PATCH 1/4] Add INPUT_REPOSITORY for another repository push --- start.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 9164fa5..1a72bf1 100755 --- a/start.sh +++ b/start.sh @@ -5,6 +5,7 @@ INPUT_BRANCH=${INPUT_BRANCH:-master} INPUT_FORCE=${INPUT_FORCE:-false} INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'} _FORCE_OPTION='' +REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY} echo "Push to branch $INPUT_BRANCH"; [ -z "${INPUT_GITHUB_TOKEN}" ] && { @@ -19,7 +20,7 @@ fi cd ${INPUT_DIRECTORY} # Ensure that the remote of the git repository of the current directory still is the repository where the github action is executed -git remote add origin https://github.com/${GITHUB_REPOSITORY} || git remote set-url origin https://github.com/${GITHUB_REPOSITORY} || true +git remote add origin https://github.com/${REPOSITORY} || git remote set-url origin https://github.com/${REPOSITORY} || true header=$(echo -n "ad-m:${INPUT_GITHUB_TOKEN}" | base64) git -c http.extraheader="AUTHORIZATION: basic $header" push origin HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION; From 39378bb47365ebcd684dbeb239bd5e339bf81550 Mon Sep 17 00:00:00 2001 From: anarcher Date: Sun, 6 Oct 2019 20:17:06 +0900 Subject: [PATCH 2/4] Update documentation and "action.yml" --- README.md | 1 + action.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 06b718f..94614e2 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ jobs: | branch | string | 'master' | Destination branch to push changes. | | force | boolean | false | Determines if force push is used. | | directory | string | '.' | Directory to change to before pushing. | +| repository | string | '' | Repository name. Default or empty repository name represents current github repository. | ## License diff --git a/action.yml b/action.yml index 09ccdc4..09949aa 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ inputs: github_token: description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}' required: true + repository: + description: 'Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})' + default: '' + required: false branch: description: 'Destination branch to push changes' required: false From d13d503a758c8c768671600812d000fac3412e0c Mon Sep 17 00:00:00 2001 From: anarcher Date: Tue, 8 Oct 2019 10:53:54 +0900 Subject: [PATCH 3/4] Add some explanation for repository input --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94614e2..b7446bf 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ jobs: | name | value | default | description | | ---- | ----- | ------- | ----------- | -| github_token | string | | Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'. | +| github_token | string | | Token for the repo. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`. | | branch | string | 'master' | Destination branch to push changes. | | force | boolean | false | Determines if force push is used. | | directory | string | '.' | Directory to change to before pushing. | -| repository | string | '' | Repository name. Default or empty repository name represents current github repository. | +| repository | string | '' | Repository name. Default or empty repository name represents current github repository. If you want to push other repository, you should make a personal access token(https://github.com/settings/tokens) and put it with github_token. | ## License From a4491334a72ea36f0f46fedd6aeaebb40a4b6e61 Mon Sep 17 00:00:00 2001 From: anarcher Date: Tue, 8 Oct 2019 23:18:45 +0900 Subject: [PATCH 4/4] Modify & Fix README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7446bf..16dbba1 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ jobs: | branch | string | 'master' | Destination branch to push changes. | | force | boolean | false | Determines if force push is used. | | directory | string | '.' | Directory to change to before pushing. | -| repository | string | '' | Repository name. Default or empty repository name represents current github repository. If you want to push other repository, you should make a personal access token(https://github.com/settings/tokens) and put it with github_token. | +| repository | string | '' | Repository name. Default or empty repository name represents current github repository. If you want to push to other repository, you should make a [personal access token](https://github.com/settings/tokens) and use it as the `github_token` input. | ## License