Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix check PR for version bump #36

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,27 @@ jobs:
echo "skip_bump=false" >> $GITHUB_OUTPUT
fi

- name: Check last PR labels
- name: Check PR labels
id: check_labels
if: |
steps.version_check.outputs.skip_bump != 'true' &&
github.event.review.state == 'approved'
env:
GH_TOKEN: ${{ github.token }}
run: |
LAST_PR_NUMBER=$(gh pr list --state merged --json number --jq '.[0].number')
LABELS=$(gh pr view "$LAST_PR_NUMBER" --json labels --jq '.labels[].name')
echo "::notice::PR used to check version bump: #$LAST_PR_NUMBER"
if [ "${{ github.event_name }}" == "pull_request" ]; then
PR_NUMBER=${{ github.event.pull_request.number }}
else
PR_NUMBER=$(gh pr list --state merged --json number --jq '.[0].number')
fi

LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name')
echo "::notice::PR used to check version bump: #$PR_NUMBER"
echo "::notice::PR labels: "[${LABELS//$'\n'/,}]""

RELEASE_TYPE=$(./.github/ci-scripts/pr-label-check.sh) || exit_code=$?
if [ "$exit_code" -ne 0 ]; then
echo "::error::PR #"$LAST_PR_NUMBER" has more than one release label"
echo "::error::PR #"$PR_NUMBER" has more than one release label"
exit $exit_code
fi

Expand Down
Loading