Skip to content

Download files

Download files #122

name: Download files
on:
schedule:
- cron: '0 3 */4 * *'
workflow_dispatch:
jobs:
update-files:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
run: |
pip install ogc-na
python -m ogc.na.download --spec file_downloads.yaml
MODIFIED="$(git status -u --porcelain=v1 | grep '^ M' | cut -c 4- | tr '\n' , | sed -r 's@,$@@')"
ADDED="$(git status -u --porcelain=v1 | grep '^??' | cut -c 4- | tr '\n' , | sed -r 's@,$@@')"
[ -n "${ADDED}{MODIFIED}" ] && ANY_CHANGED=true || ANY_CHANGED=false
echo "added_files=${ADDED}" | tee -a $GITHUB_OUTPUT
echo "modified_files=${MODIFIED}" | tee -a $GITHUB_OUTPUT
echo "any_changed=${ANY_CHANGED}" | tee -a $GITHUB_OUTPUT
- name: Commit new versions of files
uses: EndBug/add-and-commit@v9
with:
add: .
message: "Downloaded new versions of documents"
default_author: github_actions
outputs:
files-added: ${{ steps.changed-files.outputs.added_files }}
files-modified: ${{ steps.changed-files.outputs.modified_files }}
has-changes: ${{ steps.changed-files.outputs.any_changed }}
call-entail-validate-changes-workflow:
needs: update-files
if: needs.update-files.outputs.has-changes == 'true'
uses: ./.github/workflows/entail_and_validate_changes.yml
secrets: inherit
with:
files-added: ${{ needs.update-files.outputs.files-added }}
files-modified: ${{ needs.update-files.outputs.files-modified }}
repo-ref: ${{ github.ref_name }}