Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed Jul 20, 2020
0 parents commit 8b6aa8b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine:3.9

RUN apk --no-cache add openssl git curl openssh-client bash

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# push

Push changes made by actions right back into the current repository.

```yml
uses: actions-js/push@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'Push'
description: 'Push changes made by actions right back into the current repository.'
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'arrow-up-circle'
color: 'green'
28 changes: 28 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

# a github token is needed to grant
# push priviledges for the current repo
if [ -z "${GITHUB_TOKEN}" ]; then
echo "error: not found GITHUB_TOKEN"
exit 1
fi

repository="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"

git config http.sslVerify false
git config user.name "Push Bot"
git config user.email "[email protected]"
git remote add publisher "${repository}"

git show-ref
git branch --verbose

# publish any new files
git checkout master
git add -A

timestamp=$(date -u)
git commit -m "Automated push: ${timestamp} ${GITHUB_SHA}" || exit 0

git pull --rebase publisher master
git push publisher master

0 comments on commit 8b6aa8b

Please sign in to comment.