Skip to content

Add support for managing labels#52

Draft
PI-Victor wants to merge 5 commits intomainfrom
feature/clo-12-add-support-for-creating-labels
Draft

Add support for managing labels#52
PI-Victor wants to merge 5 commits intomainfrom
feature/clo-12-add-support-for-creating-labels

Conversation

@PI-Victor
Copy link
Member

/draft
/triage
/assign
/label enhancement

Signed-off-by: Victor Palade <victor@cloudflavor.io>
Signed-off-by: Victor Palade <victor@cloudflavor.io>
Signed-off-by: Victor Palade <victor@cloudflavor.io>
@linear
Copy link

linear bot commented Aug 3, 2024

@oscar-automaton oscar-automaton bot added the enhancement New feature or request label Aug 3, 2024
@PI-Victor PI-Victor marked this pull request as draft August 3, 2024 12:24
@PI-Victor
Copy link
Member Author

/retitle Add support for managing labels

@oscar-automaton oscar-automaton bot changed the title Feature/clo 12 add support for creating labels Add support for managing labels Aug 3, 2024
@PI-Victor
Copy link
Member Author

/restart-workflow

@oscar-automaton
Copy link
Contributor

Restarted worflow: "Deploy to Cloudflare Workers"

Signed-off-by: Victor Palade <victor@cloudflavor.io>
@PI-Victor
Copy link
Member Author

/restart-workflow

@oscar-automaton
Copy link
Contributor

Restarted worflow: "Deploy to Cloudflare Workers"

@PI-Victor PI-Victor requested a review from Copilot May 28, 2025 09:45
Copy link

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

Adds support for managing labels across GitHub issue and PR events, refactors command handlers, and improves configuration parsing and logging.

  • Introduce addLabels helper and extend Config with labels
  • Swap out default export for newApp, enrich webhook event handling, and update command registry
  • Add pino logging and simplify source detection in fetch, remove GitLab/Gitea support, adjust tests

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/index.spec.ts Removed legacy tests for unsupported GitLab/Gitea webhooks
src/index.ts Added pino logger, simplified header logic, dropped GitLab/Gitea
src/github/httpHandler.ts Renamed imports and variables, improved error responses
src/github/githubEvents.ts Replaced default with newApp, added new webhook handlers & addLabels
src/common.ts Extended Config and Label, enhanced parseTomlConfig
src/commands/github.ts Updated command prefixes, passed config to handlers, use addLabels
README.md Clarified project status, added /label-remove documentation
Comments suppressed due to low confidence (5)

test/index.spec.ts:36

  • Removed tests for unsupported GitLab/Gitea webhooks; consider re-adding coverage for those cases to ensure the 400 and 501 responses remain correct.
it('should fail with Unsupported webhook', async () => {

src/commands/github.ts:50

  • [nitpick] The /test command is ambiguous for restarting workflows; consider renaming it back to /restart-workflow for clarity and consistency with user expectations.
commandRegistry.registerCommand('/test', handleRestartWorkflowCommand);

src/index.ts:33

  • Mixing console.log with the newly added pino logger can lead to inconsistent output; consider using logger.info or logger.debug instead of console.log.
console.log('Request is from GitHub');

src/common.ts:32

  • The checkLabels signature expects a single Label but implementations and usages deal with arrays; update the type to Label[] or adjust the implementation accordingly.
checkLabels(labels: Label): boolean;

src/common.ts:50

  • Accessing parsedToml.Labels assumes an uppercase key; verify that the TOML file uses the same casing or adjust to parsedToml.labels to avoid missing data at runtime.
const tomlLabels = parsedToml.Labels;

Comment on lines +81 to +84
const checkLabels = (labels: Label[], tomlLabels: string[]) => {
return labels.some(label => labels.includes(label));
};

Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

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

This standalone checkLabels function is never used and duplicates logic in Config.checkLabels; consider removing it to reduce dead code and confusion.

Suggested change
const checkLabels = (labels: Label[], tomlLabels: string[]) => {
return labels.some(label => labels.includes(label));
};

Copilot uses AI. Check for mistakes.
Signed-off-by: Victor Palade <victor@cloudflavor.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request triage/accepted

Development

Successfully merging this pull request may close these issues.

1 participant