Check for new mc version #105
This file contains hidden or 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: Check for new mc version | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| jobs: | |
| check-for-new-mc-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install -r new-versions/requirements.txt | |
| - name: Run Python script | |
| run: python new-versions/check-for-new-mc-versions.py | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != '' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| # TODO: check if this works from the cron job, but it does not work from workflow_dispatch | |
| author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' | |
| assignees: okafke | |
| #reviewers: okafke | |
| commit-message: "feat: ${{ env.LATEST_VERSION }}" | |
| delete-branch: true | |
| branch: version-${{ env.LATEST_VERSION }} | |
| title: "feat: ${{ env.LATEST_VERSION }}" | |
| body: "Automatic commit: build and run ${{ env.LATEST_VERSION }} in ${{ env.LATEST_VERSION_DIR }}" |