Skip to content
29 changes: 12 additions & 17 deletions .github/workflows/new-mc-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -38,23 +40,16 @@ jobs:
echo "changes=false" >> $GITHUB_OUTPUT
fi

- name: Create new branch, commit and push
if: steps.git-check.outputs.changes == 'true'
id: push-branch
run: |
BRANCH_NAME="version-${LATEST_VERSION}"
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "feat: ${LATEST_VERSION}"
git push origin "$BRANCH_NAME"
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT

- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true' && env.LATEST_VERSION != ''
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.push-branch.outputs.branch }}
base: main
title: "feat: ${LATEST_VERSION}"
body: "This PR updates files for Minecraft version ${LATEST_VERSION}."
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
token: ${{ secrets.MC_VERSION_WORKFLOW_TOKEN }}
branch: version-${{ env.LATEST_VERSION }}
title: "feat: ${{ env.LATEST_VERSION }}"
body: "This PR updates files for Minecraft version ${{ env.LATEST_VERSION }}."