You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the input! I do agree that it would be useful, however as you've noticed there are some complications involved with updating the package.json and package-lock.json. Additionally, developers may be using other runtimes, so it may not work correctly in those cases.
As an alternative, I maintain a separate action, issue-ops/semver that can be used as a PR check to confirm that the version has been updated before a PR is merged. A usage example is below:
# This workflow checks the version of the application package that is being# built in the current pull request. If the version has already been published,# the workflow fails to prevent PRs from being merged until the version has been# incremented in the manifest file.name: Version Checkon:
pull_request:
branches:
- mainenv:
MANIFEST_PATH: package.jsonpermissions:
checks: writecontents: readpull-requests: writejobs:
check-version:
name: Version Checkruns-on: ubuntu-latestif: ${{ github.actor != 'dependabot[bot]' }}steps:
# The fetch-depth and fetch-tags options are required
- name: Checkoutid: checkoutuses: actions/checkout@v4with:
fetch-depth: 0fetch-tags: true
- name: Check Versionid: check-versionuses: issue-ops/semver@v0.2.2with:
check-only: truemanifest-path: ${{ env.MANIFEST_PATH }}
The end result is the Version Check job is added as a PR check that fails if the version in package.json is already present in the repository tags.
You would need to then need to enable the Require status checks to pass before merging option in your branch protection rules.
Thanks for the input! I do agree that it would be useful, however as you've noticed there are some complications involved with updating the
package.json
andpackage-lock.json
. Additionally, developers may be using other runtimes, so it may not work correctly in those cases.As an alternative, I maintain a separate action,
issue-ops/semver
that can be used as a PR check to confirm that the version has been updated before a PR is merged. A usage example is below:The end result is the
Version Check
job is added as a PR check that fails if the version inpackage.json
is already present in the repository tags.You would need to then need to enable the Require status checks to pass before merging option in your branch protection rules.
Let me know if that helps you!
Originally posted by @ncalteen in #854 (comment)
The text was updated successfully, but these errors were encountered: