Giter Club home page Giter Club logo

labeler's People

Contributors

bijujoseph avatar brcrista avatar dependabot[bot] avatar jnewland avatar konradpabjan avatar lionel-faber avatar natalieparellano avatar rodrigondec avatar upinetree 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

Watchers

 avatar

labeler's Issues

Cannot read number of 'undefined' Project Card event

The same error happen from issue #6 when this action is called with project_card event. I would like to use it to add a label to my issue from a project_car event.

name: project-automation

on:
  project_card:
    types: [moved]

jobs:
  automate-issues-labels:
    runs-on: ubuntu-latest
    steps:
      - name: label issues from 'In progress'
        uses: andymckay/[email protected]
        if: |
          github.event_name == 'project_card' &&
          (
            github.event.project_card.column_id == 9034006
          )
        with:
          repo-token: ${{secrets.GH_TOKEN}}
          add-labels: "c"

image

Failed to run behind a proxy server

When the runner for the workload is behind a proxy server, this action fails to connect to GitHub.

This is the workload yaml:

name: issue-labeling-automation

on:
  project_card:
    types: [moved]

jobs:
  remove_old_labels:
    runs-on: ubuntu-latest
    steps:
      - name: remove old labeling
        uses: andymckay/labeler@master
        with:
          remove-labels: "To Do, Assigned, In Progress, Testing, Done"
      
  add_to_do_label:
    needs: remove_old_labels
    # Change column ID to correct To Do column ID
    if: github.event.project_card.column_id == '######'
    runs-on: ubuntu-latest
    steps:
      - name: add to do label
        uses: andymckay/labeler@master
        with:
          add-labels: "To Do"

The following is the output we got:

- Set up job

Current runner version: '2.278.0'
Runner name: '############'
Runner group name: '########'
Machine name: '#####'
GITHUB_TOKEN Permissions
Runner is running behind proxy server 'http://proxy.####.com:pppp' for all HTTP requests.
Runner is running behind proxy server 'http://proxy.####.com:pppp' for all HTTPS requests.
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'andymckay/labeler@master'

- Remove old labeling

Run andymckay/labeler@master
  with:
    remove-labels: To Do, Assigned, In Progress, Testing, Done
    repo-token: ***
RequestError [HttpError]: request to https://api.github.com/repos/##############/issues/30 failed, reason: connect ETIMEDOUT ###.###.###.###:pppp
    at /home/github-runner/runner/########/001/_work/_actions/andymckay/labeler/master/node_modules/@octokit/request/dist-node/index.js:103:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async label (/home/github-runner/runner/########/001/_work/_actions/andymckay/labeler/master/label.js:45:33) {
  name: 'HttpError',
  status: 500,
  headers: {},
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/########/########/issues/30',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.28.9 Node.js/12.13.1 (Linux 4.15; x64)',
      authorization: 'token [REDACTED]'
    },
    request: { hook: [Function: bound bound register], validate: [Object] }
  }
}

and

- Add to do label

Run andymckay/labeler@master
  with:
    add-labels: To Do
    repo-token: ***
RequestError [HttpError]: request to https://api.github.com/repos/##############/issues/30 failed, reason: connect ETIMEDOUT ###.###.###.###:pppp
    at /home/github-runner/runner/########/001/_work/_actions/andymckay/labeler/master/node_modules/@octokit/request/dist-node/index.js:103:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async label (/home/github-runner/runner/########/001/_work/_actions/andymckay/labeler/master/label.js:45:33) {
  name: 'HttpError',
  status: 500,
  headers: {},
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/########/########/issues/30',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.28.9 Node.js/12.13.1 (Linux 4.15; x64)',
      authorization: 'token [REDACTED]'
    },
    request: { hook: [Function: bound bound register], validate: [Object] }
  }
}

Repo names, URLs and IPs redacted.

Labels deleted on consecutive calls

Version

1.0.4

What steps will reproduce the bug?

Create a workflow with two o more andymckay/[email protected] consecutive steps in the the same job adding labels. (We need to use a special token for some labels)

What is the expected behavior?

All labels are added

What do you see instead?

Last step removes the labels set in the previous steps. This is not happening always, the ratio is low, but happens regularly.

Additional information

Running a workflow similar to the following one, Step B can remove the labels added in the Step A. I think the key point here is the call to the get.issue function, probably it isn't returning the latest changes.

name: 'Example'
on:
  project_card:
    types:
      - created
      - moved
permissions:
  issues: write
  pull-requests: write
jobs:
  label-card:
    runs-on: ubuntu-latest
    steps:
      - name: Step A
        uses: andymckay/[email protected]
        with:
          add-labels: step-a
      - name: Step B
        uses: andymckay/[email protected]
        with:
          add-labels: step-b
          repo-token: ${{ secrets.B_TOKEN}}

403 error from a fork

Hi
I have this workflow:

name: Check if translation is required

on:
  pull_request:
    paths:
      - 'java/code/src/com/redhat/rhn/frontend/strings/**'
      - 'backend/**'
      - 'client/rhel/yum-rhn-plugin/**'
      - 'client/rhel/mgr-daemon/**'
      - 'client/rhel/spacewalk-client-tools/**'
      - 'web/**'
      - 'susemanager/**'
      - 'spacecmd/**'

jobs:
  run:
    name: Check by trying to locally update translation files 
    if: github.repository == 'uyuni-project/uyuni'
    runs-on: ubuntu-latest
    steps:
    - name: Cancel Previous Runs
      uses: styfle/[email protected]
      with:
        access_token: ${{ github.token }}
    - name: Add label
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      uses: andymckay/labeler@master
      with:
        add-labels: "needs-translation"
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

If I create a PR based on a branch , the label is added. If I do that based on a fork, I get this error:

Run andymckay/labeler@master
RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/andymckay/labeler/master/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async label (/home/runner/work/_actions/andymckay/labeler/master/label.js:90:3) {
  status: 403,
  headers: {
    'access-control-allow-origin': '*',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Wed, 17 Aug 2022 11:05:14 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'transfer-encoding': 'chunked',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': '07C5:4A96:2DC42FB:2F229FE:62FCCB6A',
    'x-ratelimit-limit': '1000',
    'x-ratelimit-remaining': '970',
    'x-ratelimit-reset': '1660735565',
    'x-ratelimit-resource': 'core',
    'x-ratelimit-used': '30',
    'x-xss-protection': '0'
  },
  request: {
    method: 'PATCH',
    url: 'https://api.github.com/repos/uyuni-project/uyuni/issues/5760',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.28.9 Node.js/12.22.7 (Linux 5.15; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"labels":["java","java_lint_checkstyle","java_pgsql_tests","API","old-ui","needs-translation"]}',
    request: { hook: [Function: bound bound register], validate: [Object] }
  },
  documentation_url: 'https://docs.github.com/rest/reference/issues#update-an-issue'
}

action run on a fork: https://github.com/uyuni-project/uyuni/runs/7877178806?check_suite_focus=true
action run on a branch: https://github.com/uyuni-project/uyuni/runs/7877202585?check_suite_focus=true

Is there a problem with running from a fork¿

thanks

Restrospectively label closed PRs

Hi, is there a way to retrospectively label PRs? We have thousands of unlabeled previous PRs and it might be nice to add labels so that we can search through them by our topic labels.

GitHub CI output shows that label has been removed but it is not reflected on PR.

Hi,
I am using this actions to remove labels from PR when it merged. But it seems it shows correct output but the labels is not removed from the PR. I have used it on fork repository and other repository it works there but on upstream it is not working. It only shows that task completed successfully.

name: Remove Labels

on:
  pull_request_target:
    types: [ closed ]

jobs:
  merge_job:
    if: github.event.pull_request.merged == true
    permissions:
      contents: read
      pull-requests: write    
    runs-on: ubuntu-latest
    steps:
    - uses: andymckay/labeler@master
      with:
        remove-labels: > 
          Pending Merge, 
          Waiting For Feedback, 
          Needs Review, 
          Review High Priority, 
          Needs Second Approval,
          Blocked by dependency, 
          Needs a new dev, 
          squash-merge, 
          Keep Open, 
          Stable

CI Output

Run andymckay/labeler@master
Updated labels in 10676. Added: Removed: Pending Merge,Waiting For Feedback,Needs Review,Review High Priority,Needs Second Approval,Blocked by dependency,Needs a new dev,squash-merge,Keep Open,Stable.

On upstream,
https://github.com/ankidroid/Anki-Android/pull/10676/files

Cannot read property 'pull_request' of undefined

It is not working when I am merging to master (but used to work before)

My workflow:

name: Add/remove labels when a PR is merged to master
on:
  pull_request:
    types: [ closed ]
    branches: [ master ]
jobs:
  merge_job:
    if: startsWith(github.event.ref, 'dependabot/') == false && github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - name: Add label approved
        uses: andymckay/labeler@master
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          add-labels: "approved"
          remove-labels: "lab,ready to be reviewed,work in progress"

The error:

Run andymckay/labeler@master
TypeError: Cannot read property 'pull_request' of undefined
    at getIssueNumber (/home/runner/work/_actions/andymckay/labeler/master/label.js:32:59)
    at label (/home/runner/work/_actions/andymckay/labeler/master/label.js:50:21)
    at Object.<anonymous> (/home/runner/work/_actions/andymckay/labeler/master/label.js:99:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

This seems the same error reported and hopefully fixed on this PR #27

Getting Bad Credentials while testing in GH Enterprise Server 3.6

I am trying to run this action in self-hosted GH Enterprise server (3.6) environment, but I am getting below error

RequestError [HttpError]: Bad credentials
    at /home/nvidia/Projects/actions-runner/_work/_actions/andymckay/labeler/1.0.4/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:9[7](https://smartcow.dev/TestOrg/test-repo/runs/4761?check_suite_focus=true#step:2:8):5)
    at async label (/home/nvidia/Projects/actions-runner/_work/_actions/andymckay/labeler/1.0.4/label.js:62:33) {
  status: 401,

and I noticed, it is making API call to github.com instead of the hostname of our GH server. Does this action supports my use case ? Please advise.

request: {
    method: 'GET',
    url: 'https://api.github.com/repos/TestOrg/test-repo/issues/2',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit.js/16.28.9 Node.js/12.22.7 (Linux 4.9; arm64)',
      authorization: 'token [REDACTED]'
    },
    request: { hook: [Function: bound bound register], validate: [Object] }
  },
  documentation_url: 'https://docs.github.com/rest'

Label not being removed on issue close event

Is this a configuration error on my end?

labeler.yml

# This workflow fires when an issue is closed, and removes the "in progress" label
name: Remove 'in progress' label from closed issue

on:
  issues:
    types: [closed]

jobs:
  remove-label:
    runs-on: ubuntu-latest
    steps:
    - uses: andymckay/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        remove-labels: "bug"

output

  with:
    repo-token: ***
    remove-labels: bug
RequestError [HttpError]: Validation Failed
    at /home/runner/work/_actions/andymckay/labeler/1.0.2/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async label (/home/runner/work/_actions/andymckay/labeler/1.0.2/label.js:48:3) {
  name: 'HttpError',
  status: 422,
  headers: {
    'access-control-allow-origin': '*',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
    connection: 'close',
    'content-length': '177',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Wed, 25 Mar 2020 22:14:11 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    status: '422 Unprocessable Entity',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',

Suggestion: Remove all labels

Somewhat self-explanatory. We have a ton of labels, and when we add new ones, we often have to go back through our actions and fixup all sorts of stuff, remembering to add new labels, use new label names if they get changed, etc. But it would super handy to be able to do something like this:

        uses: andymckay/[email protected]
        with:
          remove-all-labels: true
          add-labels: 'XYZ'

Cannot read property 'number' of undefined

.github/workflows/label.yml

name: Remove label on PR merge

on: 
  pull_request:
    types: [closed]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
     - uses: andymckay/[email protected]
       with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          remove-labels: "work in progress, ready to merge"
> Run andymckay/[email protected]
TypeError: Cannot read property 'number' of undefined
    at label (/home/runner/work/_actions/andymckay/labeler/1.0.2/label.js:21:45)
    at Object.<anonymous> (/home/runner/work/_actions/andymckay/labeler/1.0.2/label.js:57:1)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

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.