vuejs-translations / ryu-cho

The GitHub Action to track diffs between 2 repositories.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Gumball12 opened this issue · comments

commented

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

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

commented

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

Awesome 🙌