File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 29
29
| github_token | string | | Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'. |
30
30
| branch | string | 'master' | Destination branch to push changes. |
31
31
| force | boolean | false | Determines if force push is used. |
32
+ | directory | string | '.' | Directory to change to before pushing. |
32
33
33
34
## License
34
35
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ inputs:
15
15
force :
16
16
description : ' Determines if force push is used'
17
17
required : false
18
+ directory :
19
+ description : ' Directory to change to before pushing.'
20
+ required : false
21
+ default : ' .'
18
22
runs :
19
23
using : ' docker'
20
24
image : ' Dockerfile'
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
+ set -e
2
3
3
- INPUT_BRANCH:=' master'
4
- INPUT_FORCE:=false
4
+ INPUT_BRANCH=${INPUT_BRANCH:- master}
5
+ INPUT_FORCE=${INPUT_FORCE:- false}
6
+ INPUT_DIRECTORY=${INPUT_DIRECTORY:- ' .' }
5
7
_FORCE_OPTION=' '
6
8
7
9
echo " Push to branch $INPUT_BRANCH " ;
@@ -14,5 +16,10 @@ if ${INPUT_FORCE}; then
14
16
_FORCE_OPTION=' --force'
15
17
fi
16
18
19
+ cd ${INPUT_DIRECTORY}
20
+
21
+ # Ensure that the remote of the git repository of the current directory still is the repository where the github action is executed
22
+ git remote add origin https://github.com/${GITHUB_REPOSITORY} || git remote set-url origin https://github.com/${GITHUB_REPOSITORY} || true
23
+
17
24
header=$( echo -n " ad-m:${INPUT_GITHUB_TOKEN} " | base64)
18
25
git -c http.extraheader=" AUTHORIZATION: basic $header " push origin HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION ;
You can’t perform that action at this time.
0 commit comments