Update MC version data #9867
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
with: | |
ssh-key: ${{ secrets.COMMIT_KEY }} | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # 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 | |