Skip to content

Instantly share code, notes, and snippets.

@christeredvartsen
Created November 21, 2019 18:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save christeredvartsen/d9a3efd2e2121ef710d30cbbce6bbff3 to your computer and use it in GitHub Desktop.
Save christeredvartsen/d9a3efd2e2121ef710d30cbbce6bbff3 to your computer and use it in GitHub Desktop.
Commit back to the repository from a workflow
name: Commit from workflow
on:
push:
branches:
- master
paths-ignore:
- file.txt
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Commit some stuff
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "user@example.com"
git config user.name "User Name"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git checkout master
echo "foo" >> file.txt
git add file.txt
git commit -m "Some commit message"
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment