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: label pull requests based on their target branch #24468

Merged
merged 7 commits into from Dec 1, 2023

Conversation

Lehoczky
Copy link
Contributor

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

I've seen Daniel adding the 2.x and 3.x labels manually to PRs and wanted to help him out by labelling my own PR. Unfortunately, contributors don't have permission to edit PR labels, so I couldn't do that.

This PR makes this process automated.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

stackblitz bot commented Nov 26, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@Lehoczky Lehoczky marked this pull request as draft November 26, 2023 09:08
@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2023

Codecov Report

All modified and coverable lines are covered by tests βœ…

❗ No coverage uploaded for pull request base (main@0eb9caf). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24468   +/-   ##
=======================================
  Coverage        ?   58.65%           
=======================================
  Files           ?        5           
  Lines           ?      861           
  Branches        ?       46           
=======================================
  Hits            ?      505           
  Misses          ?      356           
  Partials        ?        0           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@Lehoczky
Copy link
Contributor Author

Looks like the GITHUB_TOKEN is missing some permissions. I'm not sure what is needed to add a label to a PR, but pull_request: write should be enough intuitively.

@danielroe
Copy link
Member

danielroe commented Nov 28, 2023

This is a great idea. ❀️

It might be that the token on your fork doesn't have permissions to add labels on the main branch, or otherwise anyone could end up doing nefarious things.

I would suggest instead using the pull_request_target event which can run when the pull request is first opened, e.g.:

on:
pull_request_target:
types:
- opened
- edited
- synchronize

This will also run 'from' the main branch so shouldn't have any permission issues.

@Lehoczky Lehoczky marked this pull request as ready for review November 30, 2023 20:04
@Lehoczky
Copy link
Contributor Author

Lehoczky commented Nov 30, 2023

Oh silly me, I haven't realized the token being used is from my fork πŸ˜…

I've updated the trigger as you suggested, thank you for the feedback!^^ This means though that the workflow won't run for this PR, but I've tested the exact same code in one of my own repositories to make sure it works.

@danielroe danielroe merged commit e95ac78 into nuxt:main Dec 1, 2023
34 checks passed
@github-actions github-actions bot mentioned this pull request Dec 1, 2023
@Lehoczky Lehoczky deleted the ci/label-prs branch December 1, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants