Skip to content

Add GitHub Actions workflows for auto-labeling, PR checks, and issue triage#13

Closed
Copilot wants to merge 5 commits intomainfrom
copilot/add-workflow-files
Closed

Add GitHub Actions workflows for auto-labeling, PR checks, and issue triage#13
Copilot wants to merge 5 commits intomainfrom
copilot/add-workflow-files

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

  • Create .github/workflows/ directory
  • Create auto-label.yml workflow file - Automatically labels PRs based on files changed
  • Create pr-checks.yml workflow file - Runs build checks on PRs and pushes to main
  • Create issue-triage.yml workflow file - Adds 'needs-triage' label to new issues
  • Create .github/labeler.yml configuration file for auto-labeling
  • Address review comments:
    • Added sync-labels: true to auto-label.yml for proper label syncing
    • Removed redundant 'opened' action check from issue-triage.yml
    • Updated labeler.yml to use **/*.yml and **/*.yaml patterns 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.

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Add workflow files for automation Add GitHub Actions workflows for auto-labeling, PR checks, and issue triage Jan 29, 2026
Copilot AI requested a review from groupthinking January 29, 2026 18:38
@groupthinking groupthinking marked this pull request as ready for review February 5, 2026 11:53
Copilot AI review requested due to automatic review settings February 5, 2026 11:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@groupthinking
Copy link
Owner

@copilot apply changes based on the comments in this thread

…ate glob patterns

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 6, 2026

@copilot apply changes based on the comments in this thread

Applied all three changes from the review in commit 3af704b:

  • Added sync-labels: true to auto-label.yml
  • Removed redundant action check from issue-triage.yml
  • Updated glob patterns to **/*.yml and **/*.yaml for subdirectory matching

groupthinking
groupthinking previously approved these changes Feb 6, 2026
@groupthinking groupthinking requested a review from Copilot February 6, 2026 16:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment on lines +3 to +6
on:
pull_request:
types: [opened, edited, synchronize]

Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +21
- name: Label PR based on files changed
uses: actions/labeler@v5
with:
sync-labels: true
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +23
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: ['needs-triage']
});
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +20 to +23
with:
sync-labels: true
with:
sync-labels: true
Copy link

Choose a reason for hiding this comment

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

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.

Copilot AI added a commit that referenced this pull request Feb 9, 2026
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>
Copilot AI added a commit that referenced this pull request Feb 9, 2026
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.
Copilot AI added a commit that referenced this pull request Feb 9, 2026
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Feb 9, 2026
- 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>
Copilot AI added a commit that referenced this pull request Feb 9, 2026
- 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>
groupthinking added a commit that referenced this pull request Feb 9, 2026
fix: consolidate actionable review feedback from PRs #4, #6, #13, #26
@groupthinking
Copy link
Owner

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).

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.

3 participants