File tree Expand file tree Collapse file tree 4 files changed +45
-10
lines changed
Expand file tree Collapse file tree 4 files changed +45
-10
lines changed Original file line number Diff line number Diff line change 77jobs :
88
99 build :
10-
10+
1111 runs-on : ubuntu-latest
12-
12+
1313 steps :
14- - uses : actions/checkout@master
15- - name : Verify action syntax
16- # The action should not publish any real changes, but should succeed.
17- uses : ' ./'
18- with :
19- github_token : ' ${{ secrets.GITHUB_TOKEN }}'
20- branch : ' ${{ github.ref }}'
14+ - uses : actions/checkout@master
15+ - name : Verify action syntax
16+ # The action should not publish any real changes, but should succeed.
17+ uses : ' ./'
18+ with :
19+ github_token : ' ${{ secrets.GITHUB_TOKEN }}'
20+ branch : ' ${{ github.ref }}'
Original file line number Diff line number Diff line change @@ -39,11 +39,37 @@ jobs:
3939 branch : ${{ github.ref }}
4040` ` `
4141
42+ An example workflow to authenticate with GitHub Platform via Deploy Keys or in general SSH:
43+
44+ ` ` ` yaml
45+ jobs :
46+ build :
47+ runs-on : ubuntu-latest
48+ steps :
49+ - uses : actions/checkout@v3
50+ with :
51+ ssh-key : ${{ secrets.SSH_PRIVATE_KEY }}
52+ - name : Create local changes
53+ run : |
54+ ...
55+ - name : Commit files
56+ run : |
57+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
58+ git config --local user.name "github-actions[bot]"
59+ git commit -m "Add changes" -a
60+ - name : Push changes
61+ uses : ad-m/github-push-action@master
62+ with :
63+ branch : ${{ github.ref }}
64+ ssh: true
65+ ```
66+
4267### Inputs
4368
4469| name | value | default | description |
4570| ---- | ----- | ------- | ----------- |
4671| github_token | string | ` ${{ github.token }} ` | [ GITHUB_TOKEN] ( https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow ) <br /> or a repo scoped <br /> [ Personal Access Token] ( https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token ) . |
72+ | ssh | boolean | false | Determines if ssh is used. |
4773| branch | string | (default) | Destination branch to push changes. <br /> Can be passed in using ` ${{ github.ref }} ` . |
4874| force | boolean | false | Determines if force push is used. |
4975| tags | boolean | false | Determines if ` --tags ` is used. |
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ inputs:
1313 description : ' GitHub url or GitHub Enterprise url'
1414 required : true
1515 default : ${{ github.server_url }}
16+ ssh :
17+ description : ' Specify if ssh should be used'
18+ required : false
1619 repository :
1720 description : ' Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
1821 default : ' '
Original file line number Diff line number Diff line change 2323
2424cd ${INPUT_DIRECTORY}
2525
26- remote_repo=" ${INPUT_GITHUB_URL_PROTOCOL} //${GITHUB_ACTOR} :${INPUT_GITHUB_TOKEN} @${INPUT_GITHUB_URL} /${REPOSITORY} .git"
26+
27+ if ${INPUT_SSH} ; then
28+ remote_repo=" git@${INPUT_GITHUB_URL} :${REPOSITORY} .git"
29+ else
30+ remote_repo=" ${INPUT_GITHUB_URL_PROTOCOL} //${GITHUB_ACTOR} :${INPUT_GITHUB_TOKEN} @${INPUT_GITHUB_URL} /${REPOSITORY} .git"
31+ fi
32+
2733git config --local --add safe.directory ${INPUT_DIRECTORY}
2834
2935git push " ${remote_repo} " HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS ;
You can’t perform that action at this time.
0 commit comments