Skip to content

Instantly share code, notes, and snippets.

@anshumanb
Created April 18, 2021 06:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anshumanb/16bf5e89354485f37912888d04d1be42 to your computer and use it in GitHub Desktop.
Save anshumanb/16bf5e89354485f37912888d04d1be42 to your computer and use it in GitHub Desktop.
Commit the result of a Github Actions job to its repository
# Adapted from
# https://github.com/actions/checkout/blob/25a956c84d5dd820d28caab9f86b8d183aeeff3d/README.md#push-a-commit-using-the-built-in-token
# https://stackoverflow.com/a/8123841/822292
name: Commit the result of this Github Actions job to this repository
on: push
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
...
- name: Commit new and updated files back to this repository
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git diff-index --quiet HEAD || git commit -m "[skip ci] Save result of action"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment