I can run docker/metadata-action with public repos. But for private repos, I get ::error::The target couldn't be found. error. Is there a way to pass a token so it can get the commit?
I can run `docker/metadata-action` with public repos. But for private repos, I get `::error::The target couldn't be found.` error. Is there a way to pass a token so it can get the commit?
Hi, can you paste your workflow here.
Or you can try to add tags input in your step of docker/meta-data-action like this:
tags:| type=ref,event=pr
Hi, can you paste your workflow here.
Or you can try to add `tags input` in your step of `docker/meta-data-action` like this:
```yaml
tags: |
type=ref,event=pr
```
2023/05/08 08:44:01 [645837c1] router: completed GET //api/v1/repos/{{org}}/{{repo}} for 172.19.0.252:44762, 404 Not Found in 2.7ms @ v1/api.go:135(v1.repoAssignment)
To use the gitea branch, use the following snippet:
- name: Docker meta
id: meta
uses: https://gitea.com/zcube/metadata-action@gitea
I have reproduced this issue. The error occurs when making the following API call:
https://{{gitea server}}//api/v1/repos/{{org}}/{{repo}}
```
2023/05/08 08:44:01 [645837c1] router: completed GET //api/v1/repos/{{org}}/{{repo}} for 172.19.0.252:44762, 404 Not Found in 2.7ms @ v1/api.go:135(v1.repoAssignment)
```
The related code is as follows:
https://github.com/docker/metadata-action/blob/c4ee3adeed93b1fa6a762f209fb01608c1a22f1e/src/main.ts#L24
https://github.com/docker/actions-toolkit/blob/31e5d12fd9af697b89eb1befb3c6f5347563e1eb/src/github.ts#L37
https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/github/src/internal/utils.ts#L15
The API can be found at https://gitea.com/api/swagger#/repository/repoGet.
It appears that the actions account does not have permission for this API.
Therefore, I have modified the code to operate based on the repository information included in the context without making the corresponding request.
https://gitea.com/zcube/metadata-action/commit/5b903a5f81f488ec30deb6bd811291afc7482e11
To use the gitea branch, use the following snippet:
```
- name: Docker meta
id: meta
uses: https://gitea.com/zcube/metadata-action@gitea
```
metadata-action doesn't use secrets.GITHUB_TOKEN to request API.
(Unlikely) Or secrets.GITHUB_TOKEN doesn't have the permission for this API.
It think the problem could be:
- metadata-action doesn't use `secrets.GITHUB_TOKEN` to request API.
- (Unlikely) Or `secrets.GITHUB_TOKEN` doesn't have the permission for this API.
export function getInput(name: string, options?: InputOptions): string {
Therefore, I think it is likely to be an authentication issue.
Even when tokens are explicitly specified as shown below, errors can still occur:
```yaml
- name: Docker meta
id: meta
uses: https://github.com/docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ steps.repository.outputs.lowercase }}
github-token: ${{ secrets.GITHUB_TOKEN }}
```
In addition, the github token is set to read the environment variable "GITHUB_TOKEN":
https://github.com/docker/metadata-action/blob/c4ee3adeed93b1fa6a762f209fb01608c1a22f1e/src/main.ts#L22
```
const toolkit = new Toolkit({githubToken: inputs.githubToken});
```
https://github.com/docker/metadata-action/blob/c4ee3adeed93b1fa6a762f209fb01608c1a22f1e/src/context.ts#L29
```
githubToken: core.getInput('github-token')
```
https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/core/src/core.ts#L126
```
export function getInput(name: string, options?: InputOptions): string {
```
Therefore, I think it is likely to be an authentication issue.
In my production instance, I can see from the log that Actions made a call to //api/v1/repos/user/repo/ (note the double slash) that Gitea returned 404 when the repo is private, and returned the content when it's public. The 404 logs is the following:
2023/05/17 13:49:19 [6464db5f] router: completed GET //api/v1/repos/harryzcy/repo for 10.42.0.228:52428, 404 Not Found in 10.7ms @ v1/api.go:135(v1.repoAssignment)
However, when I set up an test instance from scratch, I can't reproduce this. The Action send the request to /api/v1/repos/user/repo/ (single slash here) and returns 200, even with private repos. I'm not sure why this is happening. The successful log is the following:
2023/05/17 13:44:24 [6464da38] router: completed GET /api/v1/repos/harryzcy/test-workflows for 129.213.125.156:0, 200 OK in 9.2ms @ repo/repo.go:512(repo.Get)
Both of them are running v1.19.3.
In my production instance, I can see from the log that Actions made a call to `//api/v1/repos/user/repo/` (note the double slash) that Gitea returned 404 when the repo is private, and returned the content when it's public. The 404 logs is the following:
```
2023/05/17 13:49:19 [6464db5f] router: completed GET //api/v1/repos/harryzcy/repo for 10.42.0.228:52428, 404 Not Found in 10.7ms @ v1/api.go:135(v1.repoAssignment)
```
However, when I set up an test instance from scratch, I can't reproduce this. The Action send the request to `/api/v1/repos/user/repo/` (single slash here) and returns 200, even with private repos. I'm not sure why this is happening. The successful log is the following:
```
2023/05/17 13:44:24 [6464da38] router: completed GET /api/v1/repos/harryzcy/test-workflows for 129.213.125.156:0, 200 OK in 9.2ms @ repo/repo.go:512(repo.Get)
```
Both of them are running v1.19.3.
In my production instance, I can see from the log that Actions made a call to //api/v1/repos/user/repo/ (note the double slash) that Gitea returned 404 when the repo is private, and returned the content when it's public. The 404 logs is the following:
2023/05/17 13:49:19 [6464db5f] router: completed GET //api/v1/repos/harryzcy/repo for 10.42.0.228:52428, 404 Not Found in 10.7ms @ v1/api.go:135(v1.repoAssignment)
However, when I set up an test instance from scratch, I can't reproduce this. The Action send the request to /api/v1/repos/user/repo/ (single slash here) and returns 200, even with private repos. I'm not sure why this is happening. The successful log is the following:
2023/05/17 13:44:24 [6464da38] router: completed GET /api/v1/repos/harryzcy/test-workflows for 129.213.125.156:0, 200 OK in 9.2ms @ repo/repo.go:512(repo.Get)
Both of them are running v1.19.3.
Could you compare your both ROOT_URL? I think maybe one has a slash suffix but another has not.
> In my production instance, I can see from the log that Actions made a call to `//api/v1/repos/user/repo/` (note the double slash) that Gitea returned 404 when the repo is private, and returned the content when it's public. The 404 logs is the following:
>
> ```
> 2023/05/17 13:49:19 [6464db5f] router: completed GET //api/v1/repos/harryzcy/repo for 10.42.0.228:52428, 404 Not Found in 10.7ms @ v1/api.go:135(v1.repoAssignment)
> ```
>
> However, when I set up an test instance from scratch, I can't reproduce this. The Action send the request to `/api/v1/repos/user/repo/` (single slash here) and returns 200, even with private repos. I'm not sure why this is happening. The successful log is the following:
>
> ```
> 2023/05/17 13:44:24 [6464da38] router: completed GET /api/v1/repos/harryzcy/test-workflows for 129.213.125.156:0, 200 OK in 9.2ms @ repo/repo.go:512(repo.Get)
> ```
>
> Both of them are running v1.19.3.
Could you compare your both `ROOT_URL`? I think maybe one has a slash suffix but another has not.
Every git operation (fork, migration) on gitea.com gives me a 500 error.
It's probably blocked. :(
So I can't make a PR.
Open the .runner file and remove the trailing slash of address and it will work.
```
http://localhost:8000/ -> http://localhost:8000
```
This is different from what is described in README.md, so I think it should be modified to remove it from within act_runner.
https://gitea.com/gitea/act_runner/src/commit/84386c1b167d93323728f1f9e5ebda86f2a5d744/README.md#L49
I think the following patch is needed
https://gitea.com/gitea/act_runner/src/commit/84386c1b167d93323728f1f9e5ebda86f2a5d744/internal/app/run/runner.go#L187
```
GitHubInstance: r.client.Address(),
->
GitHubInstance: strings.TrimSuffix(r.client.Address(), "/"),
```
Every git operation (fork, migration) on gitea.com gives me a 500 error.
It's probably blocked. :(
So I can't make a PR.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I can run
docker/metadata-actionwith public repos. But for private repos, I get::error::The target couldn't be found.error. Is there a way to pass a token so it can get the commit?I can't reproduce this bug. Which version of
act_runnerare you using?act_runner version:
Gitea version: v1.19.1
Trigger is pull_request
Hi, can you paste your workflow here.
Or you can try to add
tags inputin your step ofdocker/meta-data-actionlike this:Could you please provide more details such as workflow files and logs?
I'll try to create a reproduced sample in the coming days
I have reproduced this issue. The error occurs when making the following API call:
https://{{gitea server}}//api/v1/repos/{{org}}/{{repo}}
The related code is as follows:
https://github.com/docker/metadata-action/blob/c4ee3adeed93b1fa6a762f209fb01608c1a22f1e/src/main.ts#L24
https://github.com/docker/actions-toolkit/blob/31e5d12fd9af697b89eb1befb3c6f5347563e1eb/src/github.ts#L37
https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/github/src/internal/utils.ts#L15
The API can be found at https://gitea.com/api/swagger#/repository/repoGet.
It appears that the actions account does not have permission for this API.
Therefore, I have modified the code to operate based on the repository information included in the context without making the corresponding request.
https://gitea.com/zcube/metadata-action/commit/5b903a5f81f488ec30deb6bd811291afc7482e11
To use the gitea branch, use the following snippet:
It think the problem could be:
secrets.GITHUB_TOKENto request API.secrets.GITHUB_TOKENdoesn't have the permission for this API.Even when tokens are explicitly specified as shown below, errors can still occur:
In addition, the github token is set to read the environment variable "GITHUB_TOKEN":
https://github.com/docker/metadata-action/blob/c4ee3adeed93b1fa6a762f209fb01608c1a22f1e/src/main.ts#L22
https://github.com/docker/metadata-action/blob/c4ee3adeed93b1fa6a762f209fb01608c1a22f1e/src/context.ts#L29
https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/core/src/core.ts#L126
Therefore, I think it is likely to be an authentication issue.
In my production instance, I can see from the log that Actions made a call to
//api/v1/repos/user/repo/(note the double slash) that Gitea returned 404 when the repo is private, and returned the content when it's public. The 404 logs is the following:However, when I set up an test instance from scratch, I can't reproduce this. The Action send the request to
/api/v1/repos/user/repo/(single slash here) and returns 200, even with private repos. I'm not sure why this is happening. The successful log is the following:Both of them are running v1.19.3.
Could you compare your both
ROOT_URL? I think maybe one has a slash suffix but another has not.No, both of them have the slash suffix.
Open the .runner file and remove the trailing slash of address and it will work.
This is different from what is described in README.md, so I think it should be modified to remove it from within act_runner.
https://gitea.com/gitea/act_runner/src/commit/84386c1b167d93323728f1f9e5ebda86f2a5d744/README.md#L49
I think the following patch is needed
https://gitea.com/gitea/act_runner/src/commit/84386c1b167d93323728f1f9e5ebda86f2a5d744/internal/app/run/runner.go#L187
Every git operation (fork, migration) on gitea.com gives me a 500 error.
It's probably blocked. :(
So I can't make a PR.