Skip to content

@W-23336786 Add action to automatically label "feature" PRs#451

Open
bcantoni wants to merge 2 commits into
mainfrom
bcantoni/add-pr-labeling
Open

@W-23336786 Add action to automatically label "feature" PRs#451
bcantoni wants to merge 2 commits into
mainfrom
bcantoni/add-pr-labeling

Conversation

@bcantoni

@bcantoni bcantoni commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

No description provided.

bcantoni added 2 commits July 6, 2026 15:54
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.
Copilot AI review requested due to automatic review settings July 6, 2026 23:06
@bcantoni bcantoni changed the title W-23336786 Add action to automatically label "feature" PRs @W-23336786 Add action to automatically label "feature" PRs Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Label workflow to create/apply a feature label on PR open.
  • Ignore .DS_Store in .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)}`;

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