Giter VIP home page Giter VIP logo

Comments (10)

austince avatar austince commented on August 15, 2024 2

The commit-specific matching might be more work, as it would require fetching all the commits that are contained in the PR, but the PR title and body should be already available.

What about adding a label config object item like pr: { body?: StringOrMatchConfig[], title?: StringOrMatchConfig[] }?

Ex:

# Add 'test' label to any change to *.spec.js files within the source dir
# or with a PR title that is in the form 'test:*'
# or with a PR body that contains the word 'test' but not 'bug'
test:
 - src/**/*.spec.js
 - pr:
     title:
       - 'test:*'
     body:
       - any: [ '*test*' ]
         all: [ '*bug*' ]

This could then be expanded to include the commits:

# Add 'test' label to any change to *.spec.js files within the source dir
# or with a PR title that is in the form 'test:*'
# or with a PR body that contains the word 'test' but not 'bug'
# or has any commits with a title in the form 'test:*'
test:
 - src/**/*.spec.js
 - pr:
     title:
       - 'test:*'
     body:
       - any: [ '*test*' ]
         all: [ '*bug*' ]
- commits:
    title:
      - 'test:*'

In typescript, this could then be modeled like:

export interface MatchConfig {
  all?: string[];
  any?: string[];
}

export type MatchConfigEntry = string | MatchConfig;

export interface PRConfigEntry {
  title?: MatchConfigEntry[];
  body?: MatchConfigEntry[];
}

export type ConfigEntry = MatchConfigEntry | { pr: PRConfigEntry };

export interface Config {
  [label: string]: ConfigEntry[];
}

const config: Config = {
  // ...
  test: [
    'src/**/*.spec.js',
    {
      pr: {
        title: ['test:*'],
        body: [
          {
            any: ['*test*'],
            all: ['*bug*']
          }
        ]
      }
    }
  ]
  // ...
}

from labeler.

ssbarnea avatar ssbarnea commented on August 15, 2024 2

Release Drafter already has the auto-labeling feature, see https://github.com/release-drafter/release-drafter#autolabeler

Sadly, AFAIK, it does not have the ability to be used as a check that prevent a change from being merged if is missing the right labels.

from labeler.

silasdavis avatar silasdavis commented on August 15, 2024 1

Can we also have the ability to specifically label based on git commit footers, e.g.

chore(foo): my fix

Risk: D
Urgency: 2

Signed-off-by: Silas Davis <[email protected]>

This would play nicely with conventional commits (https://www.conventionalcommits.org/en/v1.0.0/#specification), for example.

from labeler.

felipefrancisco avatar felipefrancisco commented on August 15, 2024

+1

from labeler.

marekpeszt avatar marekpeszt commented on August 15, 2024

+1

from labeler.

merklefruit avatar merklefruit commented on August 15, 2024

+1

from labeler.

phun-ky avatar phun-ky commented on August 15, 2024

Could this feature be expanded to let the labeler read the commit message, so for example, if a repo is following commitizen, we can tag PRs (and eventually issues), with the type of commit?

for example:

test: 💍 Remove test for untestable code, due to environment

would then add a test label

from labeler.

kalvarez2 avatar kalvarez2 commented on August 15, 2024

Hi, would it be acceptable to instead of the structured way, "simply" to add an optional prefix on the blob?

For example:

label1:
- "body:#potato"

Would add the label "label1" if the body contains the string #potato

Looking at the code, this would be simpler to add, and from the user experience point of view I think it works ok to?

from labeler.

Jaskowicz1 avatar Jaskowicz1 commented on August 15, 2024

I like that, would be extremely useful!

from labeler.

kalvarez2 avatar kalvarez2 commented on August 15, 2024

@MaksimZhukov should I make another for 5.0 branch? is there any hope that this will be merged to 4.0?
#688

from labeler.

Related Issues (20)

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.