Skip to content

Bump generator version #380

Bump generator version

Bump generator version #380

# Adds labels to pull requests based on the branch name. Labels are required by the "publish" workflow to determine
name: 'Validate PR labels'
on:
workflow_dispatch: # Lets you see what labels would be added, but doesn't actually add them because no PR triggered it
pull_request:
types:
- opened
- labeled
- unlabeled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-labels:
name: Validate PR labels
runs-on: ubuntu-latest
outputs:
VERSION_INSTRUCTION: ${{ steps.validate.outputs.VERSION_INSTRUCTION }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Validate that version bump labels are on the PR
id: validate
uses: ./.github/actions/validate-version-labels
with:
LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
upsert-pr-comment:
name: Upsert PR labels comment
if: always()
needs: validate-labels
runs-on: ubuntu-latest
steps:
- name: Build comment contents
id: bc
run: |
VERSION_INSTRUCTION=${{ needs.validate-labels.outputs.VERSION_INSTRUCTION }}
if [[ -z $VERSION_INSTRUCTION ]]; then
MESSAGE=":stop_sign: This PR needs labels to indicate how to increase the current package version in the automated workflows. Please add one of the following labels: \`none\`, \`patch\`, \`minor\`, or \`major\`."
elif [[ $VERSION_INSTRUCTION == none ]]; then
MESSAGE=":large_blue_circle: This PR has the \`none\` label set and it will not cause a version bump."
else
MESSAGE=":green_circle: This PR has valid version labels and will cause a \`$VERSION_INSTRUCTION\` bump."
fi
echo "MESSAGE=$MESSAGE" >> $GITHUB_OUTPUT
- name: Find previous comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: NPM Publishing labels
- name: Create or update comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### NPM Publishing labels :label:
${{ steps.bc.outputs.MESSAGE }}
edit-mode: replace