Coder Social home page Coder Social logo

renato66 / auto-label Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 10.0 1.12 MB

Auto Label Issue Based on Issue Description

Home Page: https://renato66.github.io/auto-label/

License: MIT License

Dockerfile 9.41% TypeScript 90.59%
action auto-label hacktoberfest label

auto-label's Introduction

coffee

🎓 Graduated in Systems Analysis and Development at FATEC São Caetano do Sul

Currently looking for jobs with:

  • Vue
  • Node
  • Vite
  • Apollo
  • Cypress
  • Postgress
  • GraphQL

Check out my portfolio 🇺🇸 or 🇧🇷

auto-label's People

Contributors

dependabot[bot] avatar dielduarte avatar guibranco avatar renato66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

auto-label's Issues

Feature: Opção failover/padrão

Allow the registration of a label if no label is found in the issue.

For example, there are labels 'labelA,' 'labelB, ' and 'labelC,' but none were mentioned in the issue. In this case, add a pre-defined label in the .yml

O action é case sensitive?

Queria entender se o action é case sensitive ou não.

Por exemplo:
Tenho a label inglês no repositório. Se a pessoa escrever INGLÊS irá funcionar da mesma forma que escrever inglês?

help

Não está colocando label com acento circunflexo

Ao executar o auto-label, ele não está colocando labels com acento.

Versão: 2.1.1

Exemplo:
Existem as seguintes labels no repositório e são palavras escritas na issue:

  • Remoto
  • CLT
  • Sênior
  • Especialista
  • São Paulo

As únicas labels inseridas foram:

  • Remoto
  • CLT
  • Especialista

Issue aonde o problema ocorreu:
qa-brasil/vagas#39

(Essa issue está com todas as labels, pois eu inseri as faltantes após o build)

labels-synonyms criando e inserindo label errada

No meu projeto fiz a seguinte configuração:
labels-synonyms: '{"Inglês":["inglês","english"]}'

Pelo que li na documentação, ele deveria procurar as palavras inglês e english na issue, encontrando alguma ia adicionar a label Inglês.

Porém ao executar a pipeline ele adicionou a label English, que não existia no repositório.

Com isso, parece que o comportamento do sinônimos não está como o esperado e não poderia criar label, já que apenas adiciona o que já existe no projeto.

Issue com esse problema: qa-brasil/vagas#49

  • error

Error

Getting the following error

*** running renato66/auto-label version 2.1.2 ***
Getting repository labels...
Repository labels found: 15
Reading labels in issue...
Error: Cannot read properties of null (reading 'replace')
/lib/functions.js:66
        const noCommentaryBody = body.replace(/\<!--(.|\n)*?-->/g, '');
                                      ^

TypeError: Cannot read properties of null (reading 'replace')
    at Object.getIssueLabels (/lib/functions.js:66:39)
    at /lib/main.js:37:45
    at Generator.next (<anonymous>)
    at fulfilled (/lib/main.js:5:5[8] 

v3

This refactor will handle:

  • use main branch as default
  • Use bun to run the action and make it work like v2
  • #73
  • refactor to use json instead of .yml to handle action inputs
  • split the code to be easy to add new functionalities

Error parsing issue

Hey,

Not always but sometimes the following issue arises:

*** running renato66/auto-label version 2.1.2 ***
Getting repository labels...
Repository labels found: 12
Reading labels in issue...
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of null
Error: Cannot read property 'replace' of null
at Object.getIssueLabels (/lib/functions.js:66:39)
at /lib/main.js:37:45
at Generator.next ()
at fulfilled (/lib/main.js:5:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My YAML:

name: Labeling new issue
on:
  issues:
    types: ['opened']
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: Renato66/auto-label@v2
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          ignore-comments: true
          default-labels: '["back-end"]'

Not getting all labels

Error:
The listLabelsForRepo gets only the first 30 labels

Fix:
Raise max labels per page to 100 (max)
Loop through all pages and get the labels

Feature: Opção de selecionar qual trecho será 'mapeado'

Sugestão:

Seria interessante ter uma forma de poder definir qual seção pode ser mapeada na hora de inserir label. Com isso a seção Labels do repositório qa-brasil/vagas seria melhor aproveitada. Não sendo mais preciso corrigir as labels da issue por causa de palavra no meio da descrição da vaga.

Problema que motivou essa feature:

Em uma issue de vaga, ela não pede ingês, mas essa empresa tem o diferencial de oferecer curso de inglês. Com isso a label Inglês é inserida na vaga.

Solução:

Será inserida a possibilidade de utilizar <!-- AUTO-LABEL:START --> e <!-- AUTO-LABEL:END --> na issue.

Regras:

  1. Caso existir AUTO-LABEL:START na issue, será mapeado apenas o que está entre START e o END que está abaixo.
    1. Não existindo, terá o mesmo comportamento de hoje, que é mapear toda a issue.
  2. Podem existir N AUTO-LABEL:START e END na issue. Sempre mapear o que está dentro de todos.

Exemplos

Comportamento mantido

No exemplo abaixo, seriam inseridas as labels Bahia, Minas Gerais e Santa Catarina.

Bahia
Minas Gerais
Santa Catarina

Novo comportamento

No exemplo abaixo, a única label inserida na issue seria Minas Gerais.

Bahia
<!-- AUTO-LABEL:START -->
Minas Gerais
<!-- AUTO-LABEL:END -->
Santa Catarina

No exemplo abaixo, seriam inseridas as labels Bahia e Santa Catarina.

<!-- AUTO-LABEL:START -->
Bahia
<!-- AUTO-LABEL:END -->
Minas Gerais
<!-- AUTO-LABEL:START -->
Santa Catarina
<!-- AUTO-LABEL:END -->

Erros por parte do usuário

O END inicial seria desconsiderado porque sempre procura o START e o END seguinte. A action não quebraria.
No exemplo abaixo, seriam inseridas as labels Bahia e Santa Catarina.

<!-- AUTO-LABEL:END -->
<!-- AUTO-LABEL:START -->
Bahia
<!-- AUTO-LABEL:END -->
Minas Gerais
<!-- AUTO-LABEL:START -->
Santa Catarina
<!-- AUTO-LABEL:END -->

O item abaixo é interessante analisar como será o comportamento. Exceção é chato de prever.
Dúvida: O melhor seria fazer igual o exemplo anterior, que é ignorar quando não tiver um par de START e END (nessa ordem), ou emitir exceção igual o exemplo abaixo?

O START sem END logo abaixo (tem um START) quebraria a execução da action. Mostrar uma mensagem clara sobre o erro do uso restrição de trecho.

Exemplo 1:

<!-- AUTO-LABEL:START -->
<!-- AUTO-LABEL:START -->
Bahia
<!-- AUTO-LABEL:END -->
Minas Gerais
<!-- AUTO-LABEL:START -->
Santa Catarina
<!-- AUTO-LABEL:END -->

Exemplo 2:

<!-- AUTO-LABEL:START -->
Bahia
<!-- AUTO-LABEL:END -->
Minas Gerais
<!-- AUTO-LABEL:START -->
Santa Catarina
<!-- AUTO-LABEL:END -->
<!-- AUTO-LABEL:START -->

enhancement

Add support for removing labels automatically

Is there a way to auto remove labels similar to how its automatically added?

for eg: when someone from the community responds to an user issue and adds "awaiting-user-input" label. Once the user/author responds w/ some input requested, the "awaiting-user-input" label should be automatically removed.

Basically folks who are looking to help with issues, need a way to filter out issues that are waiting in the queue to be attended. Those that are awaiting user/author inputs can be filtered out if we have this auto removal of labels.

Build Failure

Since yesterday the plugin is raising an error when building:

  Step 3/4 : RUN npm install --production
   ---> Running in 3973b404579b
  npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
  npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
  npm WARN deprecated [email protected]: use String.prototype.padStart()
  npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
  npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
  npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
  npm WARN deprecated [email protected]: this library is no longer supported
  npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  npm ERR! Unexpected end of JSON input while parsing near ''
  
  npm ERR! A complete log of this run can be found in:

Request: feature to find label on the titles of the issues too

const issueLabels: string[] = getIssueLabels(issue.body, repoLabels)

Could you consider adding support for parsing the issue title too.

I think it is an easy fix, just append const isssueTitleLabel: []string = getIssueLabels(issue.title, repoLabels) and concatenate both to get it.

Do you think it is worth doing that or is it not useful? I say this because title tags like feat bug are used a lot in issues of big projects and it would be worth adding it I think.

Error: Cannot read property 'replace' of null

Run action failed:

*** running renato66/auto-label version 2.1.2 ***
Getting repository labels...
Repository labels found: 7
Reading labels in issue...
{ error: 'bug',
  'need fix': 'bug',
  'not working': 'bug',
  upgrade: 'enhancement',
  help: 'question' }
Error: Cannot read property 'replace' of null
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of null
    at Object.getIssueLabels (/lib/functions.js:66:39)
    at /lib/main.js:37:45
    at Generator.next (<anonymous>)
    at fulfilled (/lib/main.js:5:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Auto-label bot fail on GH action

Got the following error in my build:

(node:1) UnhandledPromiseRejectionWarning: HttpError: Not Found
    at response.text.then.message (/node_modules/@octokit/request/dist-node/index.js:66:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.