chore(ci): Replace pr-labels-action with native GitHub expressions#20252
chore(ci): Replace pr-labels-action with native GitHub expressions#20252
Conversation
Replace the custom fork `mydea/pr-labels-action@fn/bump-node20` with built-in `github.event.pull_request.labels.*.name` expressions. Both usages already gate on `github.event_name == 'pull_request'`, so the labels context is always available when needed. This removes an external dependency and also eliminates the Node.js 20 deprecation warning this action was causing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Cloudflare
Core
Deps
Other
Bug Fixes 🐛Deno
Other
Internal Changes 🔧Ci
Deps
Deps Dev
Other
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit df48e65. Configure here.
.github/workflows/ci-metadata.yml
Outdated
| has_gitflow_label: | ||
| ${{ github.event_name == 'pull_request' && contains(steps.pr-labels.outputs.labels, ' Gitflow ') }} | ||
| ${{ github.event_name == 'pull_request' && contains(toJSON(github.event.pull_request.labels.*.name), | ||
| 'Gitflow') }} |
There was a problem hiding this comment.
Substring matching via toJSON replaces exact label matching
Medium Severity
Wrapping github.event.pull_request.labels.*.name in toJSON() converts the array to a string, causing contains() to perform substring matching instead of exact element matching. A label like "NotGitflow" or "debug" would falsely match "Gitflow" or "bug". Dropping toJSON() and using contains(github.event.pull_request.labels.*.name, 'Gitflow') directly performs exact array element matching, which is the correct and documented approach.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit df48e65. Configure here.
There was a problem hiding this comment.
this seems fine for this specific thing.
size-limit report 📦
|
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
logaretm
left a comment
There was a problem hiding this comment.
Looks like we just need to reformat this
| ${{ github.event_name == 'pull_request' && contains(toJSON(github.event.pull_request.labels.*.name), 'Gitflow') | ||
| }} | ||
| force_skip_cache: | ||
| ${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' && | ||
| contains(steps.pr-labels.outputs.labels, ' ci-skip-cache ')) }} | ||
| contains(toJSON(github.event.pull_request.labels.*.name), 'ci-skip-cache')) }} |
There was a problem hiding this comment.
Bug: The use of toJSON() with contains() causes substring matching on the label list, not exact element matching. This can lead to incorrect label detection.
Severity: MEDIUM
Suggested Fix
Remove the toJSON() function call from the expression. Use contains(github.event.pull_request.labels.*.name, 'label-name') directly to perform an exact match against the elements in the label array, ensuring correct conditional logic in the CI workflow.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: .github/workflows/ci-metadata.yml#L85-L89
Potential issue: The workflow checks for pull request labels using
`contains(toJSON(github.event.pull_request.labels.*.name), 'some-label')`. The
`toJSON()` function converts the label array into a single JSON string. Consequently,
`contains()` performs a case-insensitive substring search on this string instead of an
exact match on array elements. For example, if checking for the label `'Gitflow'`, a PR
with a label like `'No-Gitflow'` would incorrectly return `true` because `'Gitflow'` is
a substring of the JSON string `["No-Gitflow","bug"]`. This could cause CI jobs to be
skipped or run incorrectly based on partial label names.
Did we get this right? 👍 / 👎 to inform future reviews.


Summary
mydea/pr-labels-action@fn/bump-node20with built-in GitHub Actions expressionsgithub.event.pull_request.labels.*.namedirectlyBefore
After
Both usages already gate on
github.event_name == 'pull_request', so the labels context is always available when needed. This also eliminates the Node.js 20 deprecation warning thatmydea/pr-labels-actionwas causing.Test plan
Gitflowlabelci-skip-cachelabel detection still works🤖 Generated with Claude Code