This action fetches a file and commits its contents to the repository.
Required The URL of the file to fetch
Required The directory path to print the file contents
Optional The commit message
Default "Update data"
Optional Headers for the fetch request (stringified Object intializer)
Boolean: whether or not the file contents were updated
Basic usage:
name: Run test action
uses: zakwht/fetch-commit
with:
url: https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&count=1
path: APOD.json
message: Update JSON
name: update-data
on:
schedule: # run daily at midnight
- cron: 0 0 * * *
jobs:
update:
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.fetch.outputs.diff }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run test action
id: fetch
uses: zakwht/fetch-commit
with:
url: https://raw.githubusercontent.com/languages.yml
path: linguist.yml
headers: '{"Content-Type": "application/x-yaml"}'
deploy:
runs-on: ubuntu-latest
needs: update
if: needs.update.outputs.diff
steps:
- name: Checkout
uses: actions/checkout@v3