Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] What about providing the option to label issues? #15

Open
Gumball12 opened this issue May 24, 2023 · 3 comments · May be fixed by #16
Open

[feature request] What about providing the option to label issues? #15

Gumball12 opened this issue May 24, 2023 · 3 comments · May be fixed by #16
Labels
enhancement New feature or request

Comments

@Gumball12
Copy link
Contributor

Hi there. Thanks for creating such a great tool!

In my opinion, It would be nice to have the option to label it to distinguish it from other issues. I think it would look something like this:

jobs:
  ryu-cho:
    name: Ryu Cho
    runs-on: ubuntu-latest
    steps:
      - uses: vuejs-translations/ryu-cho@v1
        with:
          # ...
          label: sync # 'sync' is the label name

I think the following modification to the code would provide that feature:

// config.ts

export interface UserConfig {
  // ...
  label?: string
}

export interface Config {
  // ...
  label?: string
}

export function createConfig(config: UserConfig): Config {
  return {
    // ...
    label: config.label
  }
}
// ryu-cho.ts

export const RyuCho {
  // ...

  protected async createIssue(feed: Feed) {
    // ...

    const labels = [this.config.label].filter(v => v);

    const res = await this.github.createIssue(this.upstream, {
      title,
      body,
      labels
    })

    // ...
  }
}
// github.ts

export interface CreateIssueOptions {
  // ...
  labels?: string[]
}

export class GitHub {
  // ...

  createIssue(remote: Remote, options: CreateIssueOptions) {
    return this.api.issues.create({
      owner: remote.owner,
      repo: remote.repo
      title: options.title,
      body: options.body,
      labels: options.labels // added
  }
}

If you're okay with this, I'll try to create this feature. Thanks for reading! ☺️

@kiaking
Copy link
Member

kiaking commented May 29, 2023

Hey yes! This sounds like a good idea 👍 Maybe we should support array so that users can add multiple labels if they want?

@Gumball12
Copy link
Contributor Author

Great! I'll be happy to implement it and send you a PR request. ☺️

@kiaking
Copy link
Member

kiaking commented May 29, 2023

Awesome 🙌

@kiaking kiaking added the enhancement New feature or request label May 29, 2023
@Gumball12 Gumball12 linked a pull request Jun 3, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants