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.
Addresses unresolved review comments from PRs #6, #13, #25, #26: - src/index.ts: Add console.log→stderr redirect with unknown[] type - src/services/xapi.ts: Use URLSearchParams, add Array.isArray guard, add since_id pagination, use unknown type, avoid mutating sort - src/services/agent.ts: Add bounded memory pruning with safe iterator, process mentions oldest-first for chronological ordering - .github/workflows: Add permissions blocks, check labels exist before adding, use pull_request_target for fork PR support - README.md: Add Contributing section with absolute paths - Add CONTRIBUTING.md, PR_TITLE_GUIDE.md, pull_request_template.md Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
This commit applies all actionable review feedback from multiple pending PRs: ## PR #26 - Console.log redirect and type improvements - Added console.log redirect to stderr in main() to prevent MCP protocol conflicts - Used unknown[] instead of any[] for type safety - Refactored fetchMentions() to use URLSearchParams for cleaner URL construction - Added lastMentionId tracking for efficient pagination - Added Array.isArray guard in fetchThread() for safer data handling - Changed parseThread() to use proper typed parameters and copy array before sort ## PR #6 - Pass mention post ID for accurate replies - Added mentionPostId parameter to analyzeAndDecide() and simulateAnalysis() - Updated all callers to pass mention.post.id - Fixed response.json() type with proper type assertion - Fixed parseGrokResponse to use mentionPostId instead of root_post.id - Updated examples.ts to pass mention.post.id ## PR #13 - GitHub Actions workflows with review feedback - Created .github/workflows/auto-label.yml for PR auto-labeling - Created .github/workflows/pr-checks.yml for CI builds - Created .github/workflows/issue-triage.yml for automatic issue triage - Created .github/labeler.yml configuration for auto-labeling - All workflows use secure permissions and latest action versions ## Additional improvements from review feedback - Added MAX_PROCESSED_MENTIONS constant (10000) to prevent unbounded memory growth - Reversed mention processing order (oldest-first) for better chronological handling - Added safe pruning logic using iterator pattern to cap Set size - Improved type safety throughout with unknown[] and proper type assertions All changes compile successfully with TypeScript. No tests to run.
- xapi.ts: Use URLSearchParams for mentions URL with since_id support - xapi.ts: Add Array.isArray() guard before parseThread() in fetchThread - xapi.ts: Add Array.isArray() guard in searchTweets - xapi.ts: Change any to unknown in parseThread parameter type - agent.ts: Process mentions oldest-first and add safe iterator pruning - grok.ts: Replace any with typed response, fix as any cast - auto-label.yml: Add permissions: pull-requests: write - issue-triage.yml: Add permissions: issues: write - pr-checks.yml: Add permissions: pull-requests: write, fix syntax check - README.md: Fix double space and improve wording Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
- Add Array.isArray guard in fetchThread (xapi.ts) - Use URLSearchParams for mentions URL construction (xapi.ts) - Add since_id pagination tracking for mentions (xapi.ts) - Add console.log→stderr redirect for MCP transport (index.ts) - Add memory pruning with safe iterator for processedMentions (agent.ts) - Process mentions oldest-first for chronological pruning (agent.ts) - Replace any with unknown/proper types (xapi.ts, grok.ts) - Fix CODEOWNERS invalid usernames to @groupthinking - Add permissions blocks to all workflow files - Add label existence check in issue-triage workflow Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
|
Superseded — main has rewritten versions of all 3 workflows using github-script with label-existence guards, richer issue triage, and PR validation. The labeler.yml config is unused. auto-label.yml also had a YAML bug (duplicate with block). |
.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.