Skip to content

Update MC version data #11057

Update MC version data

Update MC version data #11057

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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ssh-key: ${{ secrets.COMMIT_KEY }}
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # 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