Skip to content

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

@Gumball12

Description

@Gumball12

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! ☺️

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions