Check Version #2
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: Check Version | |
run-name: Check Version | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
concurrency: | |
group: "checkversion" | |
cancel-in-progress: true | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Get New Version | |
run: | | |
version = npm pkg get version | xargs | |
echo "NEW=${version}" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Get Main Version | |
run: | | |
version = npm pkg get version | xargs | |
echo "MAIN=${version}" >> $GITHUB_ENV | |
- name: Compare Versions | |
run: | | |
if [ "${{env.NEW}}" = "${{env.MAIN}}" ]; then | |
exit 1 | |
fi | |
- name: Post PR Comment | |
if: failure() | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: Please bump the version in package.json! | |
preformatted: true | |
refresh-message-position: true | |
allow-repeats: true | |