Add GitHub Actions workflows for auto-labeling, PR checks, and issue triage#13
Add GitHub Actions workflows for auto-labeling, PR checks, and issue triage#13
Conversation
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces GitHub Actions automation for repository management, including automatic PR labeling based on file changes, CI/CD build checks, and automatic triage labeling for new issues.
Changes:
- Added auto-labeling workflow that applies labels to PRs based on which files are modified
- Added PR checks workflow that runs Node.js build validation on pull requests and main branch pushes
- Added issue triage workflow that automatically labels new issues with 'needs-triage'
- Created labeler configuration defining rules for documentation, source, config, and workflow labels
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/auto-label.yml |
Implements automatic PR labeling using actions/labeler@v5 |
.github/workflows/pr-checks.yml |
Runs Node.js 20 build checks with npm ci and TypeScript compilation |
.github/workflows/issue-triage.yml |
Automatically adds triage label to newly opened issues |
.github/labeler.yml |
Defines file path patterns for automatic label assignment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
…ate glob patterns Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Applied all three changes from the review in commit 3af704b:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronize] | ||
|
|
There was a problem hiding this comment.
Using the pull_request event means this workflow will not be able to apply labels on PRs coming from forks (the GITHUB_TOKEN is read-only for forked PRs). If this repo expects external contributions, consider switching to pull_request_target (and avoid checking out untrusted code) so labeling still works for fork PRs.
| - name: Label PR based on files changed | ||
| uses: actions/labeler@v5 | ||
| with: | ||
| sync-labels: true |
There was a problem hiding this comment.
Both this workflow and .github/labeler.yml assume the target labels already exist in the repo. If any label is missing, actions/labeler can fail when attempting to apply it. Consider adding a separate label-provisioning workflow (or documented setup step) to ensure required labels exist before enabling auto-labeling.
| await github.rest.issues.addLabels({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.issue.number, | ||
| labels: ['needs-triage'] | ||
| }); |
There was a problem hiding this comment.
This will fail if the needs-triage label doesn't already exist in the repository (GitHub API returns 422 for unknown labels). Consider creating the label if missing (or documenting label setup) so new repos/environments don't have a broken triage workflow.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| with: | ||
| sync-labels: true | ||
| with: | ||
| sync-labels: true |
There was a problem hiding this comment.
Bug: The auto-label.yml workflow has a duplicate with: key. This will cause the GitHub Actions workflow to fail at runtime when it's triggered.
Severity: CRITICAL
Suggested Fix
Remove the duplicate with: key from the Label PR based on files changed step in the .github/workflows/auto-label.yml file to ensure the YAML is parsed correctly by the GitHub Actions runner.
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/auto-label.yml#L20-L23
Potential issue: The GitHub Actions workflow file `auto-label.yml` contains a duplicate
`with:` key within the `Label PR based on files changed` step. While this might be valid
in some YAML parsers, the GitHub Actions runner uses a strict parser that will reject
this configuration at runtime. This will cause the `auto-label` workflow to fail every
time it is triggered, such as when a pull request is opened, preventing pull requests
from being automatically labeled. The failure occurs during workflow execution, not
during the merge, so it will not be caught by standard pre-merge checks.
.github/workflows/directoryauto-label.ymlworkflow file - Automatically labels PRs based on files changedpr-checks.ymlworkflow file - Runs build checks on PRs and pushes to mainissue-triage.ymlworkflow file - Adds 'needs-triage' label to new issues.github/labeler.ymlconfiguration file for auto-labelingsync-labels: trueto auto-label.yml for proper label syncing**/*.ymland**/*.yamlpatterns for subdirectory matching💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.