Giter VIP home page Giter VIP logo

auto-label's People

Contributors

14113 avatar banyan avatar dependabot[bot] 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

auto-label's Issues

Fix increment checks for each PR

I set up auto-label properly but when I'm testing it on new PR I have +1 check. It means on 5th PR I have 6 auto label checks. Any idea of how this could happen?

Screenshot 2019-09-13 14 01 16

Request fails when executing graphql query

I ran into some trouble trying to set up this action on a private project repo. I'm getting the same consistent error message every time the action is triggered, and I wanted to double check that my config is correct. Hoping I've just made a syntax error somewhere.

# main.workflow

workflow "Apply PR labels" {
  on = "pull_request"
  resolves = "Auto label"
}

action "Auto label" {
  uses = "banyan/auto-label@master"
  secrets = ["GITHUB_TOKEN"]
}
// auto-label.json

{
  "rules": {
    "dependency-change": ["*.lock", "*lock.json"]
  }
}
# error log output

### STARTED Auto label 22:59:53Z

Pulling image: gcr.io/github-actions-images/action-runner:latest
latest: Pulling from github-actions-images/action-runner
169185f82c45: Pulling fs layer
0ccde4b6b241: Pulling fs layer
d0372f57daa2: Pulling fs layer
165911d108d6: Pulling fs layer
54996bce1de5: Pulling fs layer
165911d108d6: Waiting
54996bce1de5: Waiting
d0372f57daa2: Verifying Checksum
d0372f57daa2: Download complete
169185f82c45: Verifying Checksum
169185f82c45: Download complete
0ccde4b6b241: Verifying Checksum
0ccde4b6b241: Download complete
54996bce1de5: Verifying Checksum
54996bce1de5: Download complete
165911d108d6: Verifying Checksum
165911d108d6: Download complete
169185f82c45: Pull complete
0ccde4b6b241: Pull complete
d0372f57daa2: Pull complete
165911d108d6: Pull complete
54996bce1de5: Pull complete
Digest: sha256:c9bb432ec5ec08ee08b040a9fccacebbbf8a91444dac4721600cf5dca9dae57e
Status: Downloaded newer image for gcr.io/github-actions-images/action-runner:latest
fc613b4dfd6736a7bd268c8a0e74ed0d1c04a959f59dd74ef2874983fd443fc9: Pulling from gct-12-xnk3et5bc0d0w3n07gb2ks2/9cc77d40ff4be729af9e5ac7f28692355212393f0a695dea9207a2ea0a7e8b49/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1
e7c96db7181b: Already exists
773afe93be0d: Already exists
223db68b3560: Already exists
609526630549: Already exists
18a3d18fedf4: Pulling fs layer
579e8928e8c7: Pulling fs layer
ddf533e1d06e: Pulling fs layer
18a3d18fedf4: Verifying Checksum
18a3d18fedf4: Download complete
18a3d18fedf4: Pull complete
ddf533e1d06e: Verifying Checksum
ddf533e1d06e: Download complete
579e8928e8c7: Verifying Checksum
579e8928e8c7: Download complete
579e8928e8c7: Pull complete
ddf533e1d06e: Pull complete
Digest: sha256:5a7af3eabcc06261b203d10ef022f933730c8479b24f4c706b62b9e622ae9aed
Status: Downloaded newer image for gcr.io/gct-12-xnk3et5bc0d0w3n07gb2ks2/9cc77d40ff4be729af9e5ac7f28692355212393f0a695dea9207a2ea0a7e8b49/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1:fc613b4dfd6736a7bd268c8a0e74ed0d1c04a959f59dd74ef2874983fd443fc9
Step 1/9 : FROM node:alpine
alpine: Pulling from library/node
Digest: sha256:d9b062a10f27ae86fa8edb1ecaa84f39946e78a0d62949bb673ee0cf8f5f2a29
Status: Downloaded newer image for node:alpine
 ---> d4edda39fb81
Step 2/9 : LABEL "com.github.actions.name"="autolabel"
 ---> Using cache
 ---> 0ae6439c82c7
Step 3/9 : LABEL "com.github.actions.description"="Add labels to Pull Request based on matched file patterns"
 ---> Using cache
 ---> 81ba4b327736
Step 4/9 : LABEL "com.github.actions.icon"="flag"
 ---> Using cache
 ---> 3a5414570914
Step 5/9 : LABEL "com.github.actions.color"="gray-dark"
 ---> Using cache
 ---> 16c4ef178489
Step 6/9 : COPY . .
 ---> Using cache
 ---> ab1efd04dcb7
Step 7/9 : RUN yarn install
 ---> Using cache
 ---> 9e560dca134a
Step 8/9 : RUN apk --no-cache add git
 ---> Using cache
 ---> 66f8c322fd91
Step 9/9 : ENTRYPOINT ["node", "/dist/entrypoint.js"]
 ---> Using cache
 ---> d82a22bd2e1e
Successfully built d82a22bd2e1e
Successfully tagged gcr.io/gct-12-xnk3et5bc0d0w3n07gb2ks2/9cc77d40ff4be729af9e5ac7f28692355212393f0a695dea9207a2ea0a7e8b49/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1:fc613b4dfd6736a7bd268c8a0e74ed0d1c04a959f59dd74ef2874983fd443fc9
Already have image (with digest): gcr.io/github-actions-images/action-runner:latest
Result:  {
  repository: {
    pullRequest: {
      id: 'pullRequestId',
      baseRefOid: 'abc',
      headRefOid: 'abc',
      baseRefName: 'master',
      headRefName: 'auto-label',
      labels: [Object]
    },
    labels: { edges: [Array] }
  },
  rateLimit: {
    limit: 1000,
    cost: 1,
    remaining: 999,
    resetAt: '2019-06-14T00:00:15Z'
  }
}
 ---> Current status
allLabels:  {
  'dependency-change': 'exampleLabelId'
}
currentLabelNames:  Set {}
diffFiles:  [
  '.github/auto-label.json',
  '.github/main.workflow',
  'Gemfile.lock',
  'mix.lock'
]
newLabelNames:  Set { 'dependency-change' }
ruledLabelNames:  Set { 'dependency-change' }
labelNamesToAdd:  Set { 'dependency-change' }
Request failed:  {
  query: '\n    mutation {\n      addLabelsToLabelable(input: {labelIds: ' +
    '["exampleLabelId"], labelableId: ' +
    '"pullRequestId"}) {\n        ' +
    'clientMutationId\n      }\n    }',
  headers: { accept: 'application/vnd.github.starfire-preview+json' }
} Something went wrong while executing your query. Please include `E752:5D05:3EFD52:9BEB49:5D02D57F` when reporting this issue.
addLabelsToLabelable has been failed. 
labelNamesToRemove:  Set {}

### FAILED Auto label 23:00:19Z (26.319s)

Failure: path must not be empty

Running v1.2 on my repo gives an error ##[error]path must not be empty and does not add the appropriate tags. I've set up the action and the config with almost identical configuration to what your have provided in examples. It worked a few times a week ago and now it is failing.

Can you provide some assisstance.

Run banyan/[email protected]
##[debug]config: {"rules":{"patch":["*profile.info.yml"],"frontend":["*.js","*.scss","*.css","*.twig",".theme"],"backend":["*.php","*.module"],"ci":[".circleci","blt"]}}
##[debug]github.context.eventName: "pull_request"
##[debug]payload.action: "synchronize"
##[debug]result: {"repository":{"pullRequest":{"id":"MDExOlB1bGxSZXF1ZXN0MzgzNzc0ODE1","baseRefOid":"7bcb69a2ce19ca73d7a5fb1e96838b40f73e0cd5","headRefOid":"0008f129ef04b9a6ee02e8e665b19e2b3447bb53","baseRefName":"develop","headRefName":"8.2.4-release","labels":{"edges":[{"node":{"id":"MDU6TGFiZWwxODkwODk3ODI4","name":"patch"}}]}},"labels":{"edges":[{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NTQ=","name":"bug"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NTU=","name":"duplicate"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NTY=","name":"enhancement"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NTc=","name":"help wanted"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NTg=","name":"good first issue"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NjE=","name":"invalid"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2NjQ=","name":"question"}},{"node":{"id":"MDU6TGFiZWw5MDUzMjM2Njc=","name":"wontfix"}},{"node":{"id":"MDU6TGFiZWwxNzMwNjg2OTkw","name":"sparkbox feature branch"}},{"node":{"id":"MDU6TGFiZWwxODIwMjEyMjcx","name":"don't merge"}},{"node":{"id":"MDU6TGFiZWwxODkwODUwNzUx","name":"size/s"}},{"node":{"id":"MDU6TGFiZWwxODkwODc4MzEz","name":"ci"}},{"node":{"id":"MDU6TGFiZWwxODkwODk3ODI4","name":"patch"}},{"node":{"id":"MDU6TGFiZWwxODkwODk3ODMx","name":"release"}},{"node":{"id":"MDU6TGFiZWwxODkwOTM1NTAw","name":"minor"}},{"node":{"id":"MDU6TGFiZWwxODk4MTQ1MzEx","name":"frontend"}},{"node":{"id":"MDU6TGFiZWwxODk4MTQ1NzM5","name":"backend"}}]}},"rateLimit":{"limit":1000,"cost":1,"remaining":994,"resetAt":"2020-03-09T17:26:51Z"}}
##[debug]allLabels: {"bug":"MDU6TGFiZWw5MDUzMjM2NTQ=","duplicate":"MDU6TGFiZWw5MDUzMjM2NTU=","enhancement":"MDU6TGFiZWw5MDUzMjM2NTY=","help wanted":"MDU6TGFiZWw5MDUzMjM2NTc=","good first issue":"MDU6TGFiZWw5MDUzMjM2NTg=","invalid":"MDU6TGFiZWw5MDUzMjM2NjE=","question":"MDU6TGFiZWw5MDUzMjM2NjQ=","wontfix":"MDU6TGFiZWw5MDUzMjM2Njc=","sparkbox feature branch":"MDU6TGFiZWwxNzMwNjg2OTkw","don't merge":"MDU6TGFiZWwxODIwMjEyMjcx","size/s":"MDU6TGFiZWwxODkwODUwNzUx","ci":"MDU6TGFiZWwxODkwODc4MzEz","patch":"MDU6TGFiZWwxODkwODk3ODI4","release":"MDU6TGFiZWwxODkwODk3ODMx","minor":"MDU6TGFiZWwxODkwOTM1NTAw","frontend":"MDU6TGFiZWwxODk4MTQ1MzEx","backend":"MDU6TGFiZWwxODk4MTQ1NzM5"}
##[debug]currentLabelNames: ["patch"]
##[error]path must not be empty
##[debug]Node Action run completed with exit code 1

The action config is set up as:

name: PR Labeler
on:
  - pull_request

jobs:
  pr-labeler:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: banyan/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Getting error "config file does not exist."

I am getting this error regarding the config file not existing, even though its in the repo at the following path:

.github/auto-label.json

Wondering if you might have any ideas on this, would love to be able to use your workflow.

image

My setup looks like the following:

.github/auto-label.json:

{
  "rules": {
    "Instant": ["instant/*"],
    "Investing": ["investing/*"],
    "MissionControl": ["support/*"],
    "migrations": ["*/migrations/*"]
  }
}

.github/workflows/labelling-workflow.yml:

name: Labelling workflow

on:
  pull_request:
    paths:
    - '**.py'
    - '**.json'

jobs:
  add_label:
    runs-on: ubuntu-latest
    steps:
      - name: auto-label
        uses: banyan/auto-label@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      # This step prints an output (time) from the previous step's action.
      - name: Echo auto-label's time
        run: echo 'The time was ${{ steps.auto-label.outputs.time }}.'

Maintenance: update action to use Node v16 by default (node12 is being deprecated)

Hello, when running this action we are getting message on deprecated node being used in the action which should be update to the Node 16.

The following actions uses node12 which is deprecated and will be forced to run on node16: banyan/auto-label@45a96386f4cac601434ed0f34db11c8df2fcac86. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/

Is it possible to update the action to run on with the Node v16?

Never-before-used labels are not added

Hey thanks this is really useful!

Issue

New labels, which have never been created manually, will never be added.

Recreate

Set the auto-label action to add a label which has never been used.

Solutions

  1. Add documentation that you must manually add any labels first.
  2. Configure the Action to add new non-existent labels.

Support rule evaluation order

Not sure how feasible this is, but it would be useful to have explicit rule evaluation order which selects the first matching rule, that way you could have nested/fallback rules.

For example:

"rules": [
    {"label": "frontend", "rule": ["src/app/"]},
    {"label": "backend", "rule": ["src/"]}
]

Another weird `path must not be empty` error

hi thanks for your great work on this action. Could you please provide some help on an error I ran into?

I'm using yml file like this:

name: Auto Label
on:
  pull_request:
    branches:
      - 'release-*'
    types: [opened]

jobs:
  auto-label:
    name: Auto Label
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: banyan/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

and get path must not be empty error.

My error log is:

Run banyan/[email protected]
  with:
    configPath: .github/auto-label.json
  env:
    GITHUB_TOKEN: ***
##[error]path must not be empty

My json file is:

{
"rules": {
"status/PTAL": [".md", ".yml", ".yaml", ".json", "media/", "scripts/"]
}
}

My PR link: pingcap/docs-cn#3631. Any clue on this? @banyan

Support for removing labels as well?

We have a workflow on our team where PR's are initially marked Needs Review (when work has been completed, and it's ready for a final approval)

Your action works very well for applying the Review Approved label once the min. number of approvals have been met. It would be nice to also remove the Needs Review label at that point!

Thanks for creating this action ๐Ÿ‘

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.