@W-23336786 Add action to automatically label "feature" PRs#451
Open
bcantoni wants to merge 2 commits into
Open
@W-23336786 Add action to automatically label "feature" PRs#451bcantoni wants to merge 2 commits into
bcantoni wants to merge 2 commits into
Conversation
opened against a base branch starting with "feature/" and labels it with the branch remainder prefixed "feature:" (e.g. base feature/rounded-corners -> label feature:rounded-corners). Uses actions/github-script to get-or-create the label (auto-created gray if missing) then apply it. The on.pull_request.branches: ['feature/**'] filter scopes the trigger to feature base branches; the job carries issues:write + pull-requests:write and the standard fork/dependabot guard.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow intended to automatically apply a feature:<name> label to “feature” pull requests, and updates .gitignore to ignore macOS .DS_Store files.
Changes:
- Add a new
PR Feature Labelworkflow to create/apply a feature label on PR open. - Ignore
.DS_Storein.gitignore.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .gitignore | Adds .DS_Store to ignored files. |
| .github/workflows/pr-feature-label.yml | Introduces an action to create/apply feature:* labels on PRs (currently keyed off the base branch in both trigger and script). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+4
to
+7
| pull_request: | ||
| branches: | ||
| - 'feature/**' | ||
| types: [opened] |
Comment on lines
+21
to
+32
| const prefix = 'feature/'; | ||
| const baseRef = context.payload.pull_request.base.ref; | ||
|
|
||
| // The `branches` filter already scopes to feature/** base branches; | ||
| // guard defensively in case the trigger scope ever changes. | ||
| if (!baseRef.startsWith(prefix)) { | ||
| console.log(`Base branch "${baseRef}" is not a feature branch; nothing to do.`); | ||
| return; | ||
| } | ||
|
|
||
| const label = `feature:${baseRef.slice(prefix.length)}`; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.