first commit

This commit is contained in:
Adam Dobrawy
2019-08-24 13:04:49 +02:00
commit c4ba72ddd2
4 changed files with 72 additions and 0 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM alpine
LABEL "name"="git-push"
LABEL "maintainer"="Adam Dobrawy <git+push@jawnosc.tk>"
LABEL "version"="0.0.1"
LABEL "com.github.actions.name"="cURL for GitHub Actions"
LABEL "com.github.actions.description"="Runs cURL in an Action"
LABEL "com.github.actions.icon"="upload-cloud"
LABEL "com.github.actions.color"="green"
COPY README.md LICENSE start.sh /
RUN apk add --no-cache git
CMD ["/start.sh"]

37
README.md Normal file
View File

@ -0,0 +1,37 @@
# GitHub Action for Git Push
The GitHub Actions for pushing to Git repository local changes authorizing using GitHub token.
## Usage
### Example Workflow file
An example workflow to authenticate with Google Cloud Platform:
```yaml
jobs:
build:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@master
...
- run: npm install
- uses: actions/checkout@master
```
Subsequent actions in the workflow will then be able to use `gcloud` as that user ([see `cli` for examples](/cli)).
### Secrets
* `GCLOUD_AUTH` **Required** Base64 encoded service account key exported as JSON
- For information about service account keys please see the [Google Cloud docs](https://cloud.google.com/sdk/docs/authorizing)
- For information about using Secrets in Actions please see the [Actions docs](https://developer.github.com/actions/creating-workflows/storing-secrets/).
Example on encoding from a terminal : `base64 ~/<account_id>.json`
## License
The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).
Container images built with this project include third party materials. See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details.

14
action.yml Normal file
View File

@ -0,0 +1,14 @@
name: 'Git Push'
description: 'Pushing to Git repository local changes'
author: 'ad-m'
inputs:
repo-token:
description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
required: true
branch:
description: 'Destination branch to push changes'
required: false
default: 'master'
runs:
using: 'docker'
image: 'Dockerfile'

5
start.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
echo "Push to branch $BRANCH";
header=$(echo -n "ad-m:$INPUT_REPO_TOKEN" | base64)
git -c http.extraheader="AUTHORIZATION: basic $header" push origin refs/remotes/origin/master:master;