Skip to content

add support for pr labels - #240

Closed
jackleslie wants to merge 1 commit into
changesets:mainfrom
jackleslie:pr-labels
Closed

add support for pr labels#240
jackleslie wants to merge 1 commit into
changesets:mainfrom
jackleslie:pr-labels

Conversation

@jackleslie

Copy link
Copy Markdown
Contributor

Context

We would like to attach some labels to the PRs that changesets action opens.

Changes

  • Adding an optional labels action options
  • Update the created PR with provided labels

Considerations

  • We need to use issues rather than pulls - however they mean the same thing
  • Should we provide a default label? I imagine not
  • Should we run addLabel when updating a PR as well?

@changeset-bot

changeset-bot Bot commented Dec 6, 2022

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 200235d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Andarist

Andarist commented Dec 6, 2022

Copy link
Copy Markdown
Member

There is already a similar PR open here. I think I don't want to add this to this action as mentioned in the comment there: #182 (comment)

@jackleslie

Copy link
Copy Markdown
Contributor Author

Ah nice, will close this then - TIL about actions/labeler, hopefully your PR gets merged for that

Thanks @Andarist!

@jackleslie jackleslie closed this Dec 6, 2022
@Andarist

Andarist commented Dec 6, 2022

Copy link
Copy Markdown
Member

@jacklesliewise note that you can use it quite easily even today, just by using my action over theirs: Andarist/actions-labeler@pr-number-input

@jackleslie

jackleslie commented Dec 7, 2022

Copy link
Copy Markdown
Contributor Author

@Andarist I actually managed to achieve what we wanted with the current version of actions/labeler

When creating the pull_request_target workflow you can specify a branch pattern:

name: 'Pull Request Labeler'
on:
  pull_request_target:
    types:
      - opened
    branches:
      - 'changeset-release/**'

Edit: the branches is for target branch - for head branch we do

if: startsWith(github.head_ref, 'changeset-release/')

@Andarist

Andarist commented Dec 7, 2022

Copy link
Copy Markdown
Member

Nice 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants