Issue with getTree function
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- github, javascript, typescript
Hướng nghiên cứu
Start with the github.rest.git.getTree call shown in the workflow and trace how its parameters become the request URL. Compare that generated URL with the documented get-a-tree endpoint and the working curl example. Done means the cause of the 404 is documented or corrected, with a test covering the resulting request if this repository owns that behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
I'm consistently receiving 404 errors when calling the github.rest.git.getTree API. From my testing it appears the URL parameter ?tree= is causing the issue, as if the API does not support this.
To Reproduce
my GithHub action is configured as:
- name: Commit Changes
id: commit-changes
uses: actions/github-script@v7
env:
BRANCH: ${{ inputs.branch }}
with:
retries: 3
github-token: ${{ steps.app-token.outputs.token }}
script: |
const tree = await github.rest.git.getTree({
owner: context.repo.owner,
repo: context.repo.repo,
tree: process.env.BRANCH,
})
where inputs.branch is set to main, and the 404 response is:
RequestError [HttpError]: Not Found
at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:9537:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async requestWithGraphqlErrorHandling (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:9276:20)
at async Job.doExecute (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:10275:18) {
status: 404,
response: {
url: 'https://api.github.com/repos/<my_org>/<my_repo>/git/trees/?tree=main',
status: 404,
headers: {
....
},
data: {
message: 'Not Found',
documentation_url: 'https://docs.github.com/rest/git/trees#get-a-tree',
status: '404'
}
When I test locally with Curl, this is what I see:
export TREE="https://api.github.com/repos/$OWNER/$REPO/git/trees/main"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"$TREE"
and the output is:
{
"sha": "ff70bc62cd0fb0a01bd14a2b332b6b106b32ae38",
"url": "https://api.github.com/repos/<my_org>/<my_repo>/git/trees/ff70bc62cd0fb0a01bd14a2b332b6b106b32ae38",
"tree": [
{
"path": ".github",
"mode": "040000",
"type": "tree",
"sha": "795e917b75291b5c0fa3fa219401bce1801420b5",
"url": "https://api.github.com/repos/<my_org>/<my_repo>/git/trees/795e917b75291b5c0fa3fa219401bce1801420b5"
},
...
When I run the same test, but include the ?tree= parameter, I get the same 404 error:
export TREE="https://api.github.com/repos/$OWNER/$REPO/git/trees/?tree=main"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"$TREE
and the output is:
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/git/trees#get-a-tree",
"status": "404"
}
Expected behavior
I expect a tree object to be returned.
Screenshots
RequestError [HttpError]: Not Found
at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:9537:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async requestWithGraphqlErrorHandling (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:9276:20)
at async Job.doExecute (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:10275:18) {
status: 404,
response: {
url: 'https://api.github.com/repos/<my_org>/<my_repo>/git/trees/?tree=main',
status: 404,
headers: {
....
},
data: {
message: 'Not Found',
documentation_url: 'https://docs.github.com/rest/git/trees#get-a-tree',
status: '404'
}
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
Unless I'm misunderstanding how to use this API, it appears to be a bug.
- Ngôn ngữ chính
- TypeScript
- Star
- 5k
- Fork
- 586
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của actions/github-script
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
actions/github-script#728 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
actions/github-script#727 · 1 reaction ·
-
{ Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
actions/github-script#724 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
actions/github-script#723 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
actions/github-script#714 · 1 bình luận · 4 reaction ·
Tất cả issue của actions/github-script
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
modelcontextprotocol/inspector#2458 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
carbon-design-system/ibm-products#9907 ·