Revert "Add deploy key functionality (#115)" (#119)

This reverts commit d4a6a7883a40e2ff04f1943ca6871fc03fc5a738.
This commit is contained in:
Pascal Zimmermann 2022-05-04 13:04:15 +02:00 committed by GitHub
parent d4a6a7883a
commit 21d44fe927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 45 deletions

View File

@ -7,14 +7,14 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Verify action syntax
# The action should not publish any real changes, but should succeed.
uses: './'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
branch: '${{ github.ref }}'
- uses: actions/checkout@master
- name: Verify action syntax
# The action should not publish any real changes, but should succeed.
uses: './'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
branch: '${{ github.ref }}'

View File

@ -39,37 +39,11 @@ jobs:
branch: ${{ github.ref }}
```
An example workflow to authenticate with GitHub Platform via Deploy Keys or in general SSH:
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Create local changes
run: |
...
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Add changes" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
ssh: true
```
### Inputs
| name | value | default | description |
| ---- | ----- | ------- | ----------- |
| 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). |
| ssh | boolean | false | Determines if ssh is used. |
| branch | string | (default) | Destination branch to push changes. <br /> Can be passed in using `${{ github.ref }}`. |
| force | boolean | false | Determines if force push is used. |
| tags | boolean | false | Determines if `--tags` is used. |

View File

@ -13,9 +13,6 @@ inputs:
description: 'GitHub url or GitHub Enterprise url'
required: true
default: ${{ github.server_url }}
ssh:
description: 'Specify if ssh should be used'
required: false
repository:
description: 'Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
default: ''

View File

@ -23,13 +23,7 @@ fi
cd ${INPUT_DIRECTORY}
if ${INPUT_SSH}; then
remote_repo="git@${INPUT_GITHUB_URL}:${REPOSITORY}.git"
else
remote_repo="${INPUT_GITHUB_URL_PROTOCOL}//${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@${INPUT_GITHUB_URL}/${REPOSITORY}.git"
fi
remote_repo="${INPUT_GITHUB_URL_PROTOCOL}//${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@${INPUT_GITHUB_URL}/${REPOSITORY}.git"
git config --local --add safe.directory ${INPUT_DIRECTORY}
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;