Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions shared-overwrite/.github/workflows/mt-check-data-outdated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ORIGINAL FILE: https://github.com/mtransitapps/commons/tree/master/shared-overwrite
name: MT check data outdated
on:
workflow_dispatch: # manual
schedule:
- cron: '0 12 * * 1,3,4,6,7' # Mon, Wed, Thu, Sat & Sun @ 12pm UTC # https://crontab.guru/#0_12_*_*_1,3,4,6,7
# gh workflow run mt-check-data-outdated.yml --ref $(git rev-parse --abbrev-ref HEAD)
# gh run list --workflow=mt-check-data-outdated.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# git branches & sha
MT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
MT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
MT_TARGET_BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
MT_DEFAULT_BRANCH_NAME: ${{ github.event.repository.default_branch }}
# repo type
MT_IS_SUBMODULE: ${{ contains(fromJSON('["mtransitapps/commons", "mtransitapps/commons-java", "mtransitapps/parser", "mtransitapps/commons-android"]'), github.repository) }}
MT_IS_MAIN_REPO: ${{ endsWith(github.repository, '/mtransit-for-android') }}
MT_IS_AGENCY_REPO: ${{ ! contains(fromJSON('["mtransitapps/commons", "mtransitapps/commons-java", "mtransitapps/parser", "mtransitapps/commons-android"]'), github.repository) && ! endsWith(github.repository, '/mtransit-for-android')}}
MT_IS_AGENCY_RDS: ${{ ! contains(github.repository, '-bike-') }}
MT_IS_AGENCY_BIKE: ${{ contains(github.repository, '-bike-') }}
# git commit & push
MT_ORG_GIT_COMMIT_ON: ${{ secrets.MT_ORG_GIT_COMMIT_ON }}
MT_ORG_GIT_COMMIT_OFF: ${{ secrets.MT_ORG_GIT_COMMIT_OFF }}
MT_GIT_COMMIT_ON: ${{ secrets.MT_GIT_COMMIT_ON }}
MT_GIT_COMMIT_OFF: ${{ secrets.MT_GIT_COMMIT_OFF }}
jobs:
MT-CHECK-DATA-OUTDATED-JOB:
# if: ${{ env.MT_IS_MAIN_REPO != 'true' && env.MT_IS_AGENCY_BIKE != 'true' }} # can NOT use env here:
if: ${{ ! endsWith(github.repository, '/mtransit-for-android') && ! contains(github.repository, '-bike-') }}
name: "MT Check Data Outdated"
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: MT check out main repository code (with submodules)
uses: actions/checkout@v6
with:
submodules: true # required to set right token
token: ${{ secrets.MT_PAT }}
fetch-depth: 0 # fetch all (not required util release build)

- name: MT setup
id: mt-setup
uses: ./.github/actions/setup

- name: MT check if data is outdated & trigger download
continue-on-error: true
run: |
if ./agency-parser/check_data_outdated.sh; then
echo ">> Data is up-to-date.";
else
echo ">> Data is outdated. Triggering mt-download-data.yml workflow...";
gh workflow run mt-download-data.yml
fi
env:
GH_TOKEN: ${{ secrets.MT_PAT }}