Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

HttpError: Not Found when run with new yml config #6

Closed
flexzuu opened this issue Aug 14, 2019 · 7 comments · Fixed by #8
Closed

HttpError: Not Found when run with new yml config #6

flexzuu opened this issue Aug 14, 2019 · 7 comments · Fixed by #8

Comments

@flexzuu
Copy link
Contributor

flexzuu commented Aug 14, 2019

I tried to use the labeler with the new YML syntax and it seems there is an issue on how the labeler is published. I always get the following msg.
I tested the v2 and v2.0.0 releases

Run actions/labeler@v2.0.0
  with:
    repo-token: ***
    configuration-path: .github/labeler.yml
##[error]HttpError: Not Found
##[error]Not Found
##[error]Node run failed with exit code 1
name: "Pull Request Labeler"
on: pull_request

jobs:
  label:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/labeler@v2.0.0
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
@thanosexcite
Copy link

I also face the same issue. Here is the workflow where labeler fails:

name: Foo workflow
on:
  pull_request:
    branches:
      - master
    paths:
      - environments/dev/*
      - modules/*
jobs:
  pr_labeler:
    name: PR Labeler
    runs-on: ubuntu-18.04
    steps:
      - name: Set PR label
        if: github.event.action == 'opened' || github.event.action == 'synchronize'
        uses: actions/labeler@v2.0.0
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}

Bellow are the job logs:

2019-08-14T08:26:48.0519176Z Current runner version: '2.156.4'
2019-08-14T08:26:48.0555368Z Prepare workflow directory.
2019-08-14T08:26:48.1204567Z Prepare all required actions.
2019-08-14T08:26:50.5643352Z action.yml for action: '/home/runner/work/_actions/actions/labeler/v2.0.0/action.yml'.
2019-08-14T08:26:50.7610723Z Start tracking orphan processes.
2019-08-14T08:26:50.9216637Z ##[group]Run actions/labeler@v2.0.0
2019-08-14T08:26:50.9301308Z with:
2019-08-14T08:26:50.9301550Z   repo-token: ***
2019-08-14T08:26:50.9301606Z   configuration-path: .github/labeler.yml
2019-08-14T08:26:50.9301662Z ##[endgroup]
2019-08-14T08:26:53.5033056Z ##[error]HttpError: Not Found
2019-08-14T08:26:53.5048299Z ##[error]Not Found
2019-08-14T08:26:53.5097429Z ##[error]Node run failed with exit code 1
2019-08-14T08:26:53.5259432Z Start cleaning up orphan processes.

@Fumler
Copy link

Fumler commented Aug 14, 2019

Getting the same issue (on a private repo):
image

.github/workflows/labeler.yml

name: Labeler
on: [pull_request]
jobs:
  label:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/labeler@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/labeler.yml

logan:
  - packages/logan/*

main:
  - packages/main/*

eavis:
  - packages/eavis/*

shared:
  - packages/shared/*

xavier:
  - packages/xavier/*

gambit:
  - packages/gambit/*

@xzilja
Copy link

xzilja commented Aug 15, 2019

It does resolve to actions/labeler@master, but fails afterwards as lib is not present there

eebs added a commit to eebs/labeler that referenced this issue Aug 16, 2019
Fixes actions#6

When fetching the configuration content from the file specified by
`configuration-path`, we should load the content from the ref of the PR.

By default, `repos.getContents` will [use the repository's default
branch][1] if no `ref` is specified.

When first configuring this action, assuming the configuration file is
added in the same PR as the action, the configuration file will not
exist on the default branch. This causes an `HttpError: Not Found` to
occur when attempting to load the configuration from the default branch.

This commit updates the call to `getContents` to add the `ref`
parameter, set to the `GITHUB_SHA` value from the context. This will
cause the action to load the contents of the configuration file from the
ref of the PR, rather than the default branch.

---

This PR also updates the packages to use version 1.0.0 of all the
toolkit action packages, as they were using local files before.

I noticed that `src/main.ts` is not formatted according to the prettier
rules. I'm happy to open another PR that applies prettier to the current
source. I had to disable prettier during implementation of this commit
in order to keep the changes relevant to this PR.

[1]: https://developer.github.com/v3/repos/contents/#get-contents
@tim-evans
Copy link

I'm encountering this issue too; I've validated the yml file, and we're using the default configuration provided by labeler.

damccorm pushed a commit that referenced this issue Aug 23, 2019
* Fetch configuration content from PR ref

Fixes #6

When fetching the configuration content from the file specified by
`configuration-path`, we should load the content from the ref of the PR.

By default, `repos.getContents` will [use the repository's default
branch][1] if no `ref` is specified.

When first configuring this action, assuming the configuration file is
added in the same PR as the action, the configuration file will not
exist on the default branch. This causes an `HttpError: Not Found` to
occur when attempting to load the configuration from the default branch.

This commit updates the call to `getContents` to add the `ref`
parameter, set to the `GITHUB_SHA` value from the context. This will
cause the action to load the contents of the configuration file from the
ref of the PR, rather than the default branch.

---

This PR also updates the packages to use version 1.0.0 of all the
toolkit action packages, as they were using local files before.

I noticed that `src/main.ts` is not formatted according to the prettier
rules. I'm happy to open another PR that applies prettier to the current
source. I had to disable prettier during implementation of this commit
in order to keep the changes relevant to this PR.

[1]: https://developer.github.com/v3/repos/contents/#get-contents

* Remove exec, io, tool-cache
@michaelfarrell76
Copy link

I also continue to get this issue using the default configuration

name: Labeler
on: [pull_request]

jobs:
  label:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/labeler@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

@sudochia
Copy link

I also continue to get this issue using the default configuration

name: Labeler
on: [pull_request]

jobs:
  label:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/labeler@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

Check the usage here - https://github.com/actions/labeler#usage. Basically, you need to have the file .github/labeler.yml

@valtersantosmatosmanulife

My issue was that I wrote .github/labeler.yaml instead of .github/labeler.yml (be careful with that)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants