Skip to content

Auto-Update Bulletin-A files #359

Auto-Update Bulletin-A files

Auto-Update Bulletin-A files #359

# This workflow will install Python dependencies and get the latest bulletin-A file
name: Auto-Update Bulletin-A files
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.11]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up mamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 'latest'
environment-file: environment.yml
init-shell: bash
environment-name: pyTMD
cache-environment: true
post-cleanup: 'all'
create-args: >-
python=${{ matrix.python-version }}
flake8
pytest
pytest-cov
cython
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install --no-deps .
python -c "import pyTMD.time; pyTMD.time.update_bulletin_a(verbose=True)"
- name: Check for changes
id: changes
run: |
if [ -n "$(git status --porcelain)" ] ; then
echo "DETECTED=true" >> $GITHUB_OUTPUT;
echo "::debug::Changes detected";
else
echo "DETECTED=false" >> $GITHUB_OUTPUT;
echo "::debug::No changes detected";
fi
- name: Append delta time file
if: steps.changes.outputs.DETECTED == 'true'
run: |
python -c "import pyTMD.time; pyTMD.time.append_delta_time(verbose=True)"
- name: Create pull request
if: steps.changes.outputs.DETECTED == 'true'
uses: peter-evans/create-pull-request@v5
with:
assignees: ${{ github.actor }}
title: "data: automatic bulletin updates"