Update MC version data #8917
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update MC version data | |
on: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- '.github/workflows/update-mc-versions.yml' | |
- 'update_versions.py' | |
schedule: | |
- cron: '30 * * * *' | |
workflow_dispatch: | |
# GITHUB_TOKEN doesn't need permissions, since we're using a custom SSH key to work around GitHub Actions | |
# not running other workflows on push when changes are pushed with a GITHUB_TOKEN: | |
# https://github.com/orgs/community/discussions/25702 | |
# https://stackoverflow.com/a/74563109 | |
permissions: {} | |
jobs: | |
update_mc_versions: | |
name: "Update MC versions" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
ssh-key: ${{ secrets.COMMIT_KEY }} | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 | |
with: | |
python-version-file: '.python-version' # Read python version from .python-version | |
cache: 'poetry' | |
- run: poetry install | |
- run: poetry run python update_versions.py | |
- name: Check for changes | |
run: git diff --quiet --exit-code -- version/ || echo 'CHANGED=true' >> "$GITHUB_ENV" | |
- name: Push changes | |
if: ${{ env.CHANGED == 'true' }} | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add ./version/**.json | |
git commit -m "Update MC versions ($(date --iso-8601))" | |
git push | |