Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Failure in Gitea API when using labeler Github action #30917

Closed
mariusrugan opened this issue May 9, 2024 · 3 comments · Fixed by #30943
Closed

Failure in Gitea API when using labeler Github action #30917

mariusrugan opened this issue May 9, 2024 · 3 comments · Fixed by #30943
Labels
Milestone

Comments

@mariusrugan
Copy link

mariusrugan commented May 9, 2024

Description

I am using actions/labeler@v5 with Gitea's Actions, the runner is running gitea/act_runner:nightly-dind-rootless, the labels are not placed on the issue & the actual workflow step is failing with the following message, added below

It's coming from the Gitea API, & i'd like to understand what how can i help to improve this.

Error:

The configuration file (path: .gitea/labeler.yaml) was found locally, reading from the file
::error::HttpError: []: json: cannot unmarshal number " into Go struct field IssueLabelsOption.Labels of type int64
::error::[]: json: cannot unmarshal number " into Go struct field IssueLabelsOption.Labels of type int64

the job looks very simple:

jobs:
  labeler:
    name: Labeler
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Labeler
        uses: actions/labeler@v5
        with:
          configuration-path: .gitea/labeler.yaml
          sync-labels: true

labeler.yaml

Documentation:
- changed-files:
  - any-glob-to-any-file: docs/**

EDIT
from gitea's log:

...eb/routing/logger.go:102:func1() [I] router: completed PUT /api/v1/repos/mariusrugan/example-repo/issues/104/labels for 1.2.3.4:37056, 422 Unprocessable Entity in 20.9ms @ v1/api.go:689(v1.Routes.func1.10.1.1.2.2.bind[...])

Many thanks in advance!

Gitea Version

1.21.11

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker container

Database

SQLite

@Zettat123
Copy link
Contributor

In the GitHub API, the labels field of the request body is an array of strings. However, in the Gitea API, the labels field is a list of integer label IDs. actions/labeler action uses the GitHub API so Gitea cannot parse the request correctly.

To fix this issue, we need to modify the Gitea API to make it compatible with GitHub. But this would be a breaking change.

@mariusrugan
Copy link
Author

mariusrugan commented May 10, 2024

Thanks a lot for the input,

So a fork / config flag change of the labeler action to have it working on Gitea side would be much more easy.

@lunny
Copy link
Member

lunny commented May 10, 2024

Maybe we can have do a compatible to accept both string and int for that field.

lunny pushed a commit that referenced this issue May 13, 2024
Resolve #30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue May 13, 2024
Resolve go-gitea#30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>
lunny pushed a commit that referenced this issue May 13, 2024
Backport #30943 by @Zettat123

Resolve #30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>

Co-authored-by: Zettat123 <zettat123@gmail.com>
@lunny lunny added this to the 1.22.0 milestone May 13, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants