Fix mode unpins a reusable workflow call when the same repository is also used as a step action
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu từ internal/workflowfile/rewrite.go, tại RewriteActionRefs và subpathRewriteLookup mà issue có liên kết tới. Tái hiện lỗi bằng workflow trong issue, sau đó kiểm tra xem các giá trị jobs.<job_id>.uses có bị bỏ qua hay không, và các ref trong .github/workflows/ có không bị coi là subpath của action hay không. Hoàn thành khi lệnh gọi reusable workflow giữ nguyên SHA còn action trong step vẫn được viết lại thành tag.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When a workflow calls a reusable workflow pinned by a commit SHA (jobs.<job_id>.uses), and a step in the same file uses an action from the same repository pinned by the same SHA, gh actions-lock rewrites the reusable workflow call to the tag too.
The lockfile doesn't lock reusable workflow calls (#179), so this replaces the SHA pin with a tag that nothing locks. Unless the tag belongs to an immutable release, it can be moved to another commit.
Version
gh-actions-lock v0.4.1
Steps to reproduce
Create .github/workflows/test.yaml in an empty Git repository:
name: test
on: pull_request
jobs:
gomodule:
uses: suzuki-shunsuke/download-go-module-action/.github/workflows/download.yaml@e03acd0c9d3d230019ebb7bd4a62507431fe4316 # v0.0.10
permissions:
contents: read
test:
needs: [gomodule]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: suzuki-shunsuke/download-go-module-action/restore@e03acd0c9d3d230019ebb7bd4a62507431fe4316 # v0.0.10
Run gh actions-lock.
Actual behavior
Both uses: lines are rewritten to the tag:
gomodule:
- uses: suzuki-shunsuke/download-go-module-action/.github/workflows/download.yaml@e03acd0c9d3d230019ebb7bd4a62507431fe4316 # v0.0.10
+ uses: suzuki-shunsuke/download-go-module-action/.github/workflows/[email protected]
...
steps:
- - uses: suzuki-shunsuke/download-go-module-action/restore@e03acd0c9d3d230019ebb7bd4a62507431fe4316 # v0.0.10
+ - uses: suzuki-shunsuke/download-go-module-action/[email protected]
Expected behavior
Only the step action is rewritten. The reusable workflow call keeps the SHA, as it does when the file has no step action from that repository.
The README says:
Reusable workflows called at
jobs.<id>.usesfrom another repository are not locked (#179).
And the docs say:
It doesn't pin calls to reusable workflows (
jobs.<job_id>.uses). To pin a reusable workflow, reference it by its full commit SHA.
So a full commit SHA is the only pin a reusable workflow call has, and gh actions-lock shouldn't rewrite it.
If the step is replaced with an action from another repository (e.g. actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1), the reusable workflow call is left as it is.
Cause
RewriteActionRefs rewrites every scalar uses: value in the file, including job-level reusable workflow calls.
The replacement map has a key for the step action, suzuki-shunsuke/download-go-module-action@e03acd0c.... subpathRewriteLookup matches owner/repo/<path>@ref against an owner/repo@ref key, so .github/workflows/download.yaml is treated as an action sub-path like restore, and the reusable workflow call gets the step action's new ref.
Skipping jobs.<job_id>.uses (or refs whose path starts with .github/workflows/) in the rewrite would fix it.
Workaround
Pin the reusable workflow call to the SHA again after running gh actions-lock. Running gh actions-lock again after that keeps the SHA.
- Ngôn ngữ chính
- Go
- Star
- 253
- Fork
- 15
- Merge trung bình
- 19 giờ 30 phút
- Pull request đã merge (30 ngày)
- 60
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 github/gh-actions-lock
-
Dependabot drops an unchanged transitive dependency when bumping a composite actionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
github/gh-actions-lock#257 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
--migrate-local-actions rewrites action files in nested worktrees and submodulesCó thể đã có người làm @aksestok đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
github/gh-actions-lock#253 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
github/gh-actions-lock#252 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
github/gh-actions-lock#247 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
github/gh-actions-lock#246 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của github/gh-actions-lock
Issue tương tự
-
needs-area
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/typespec-azure#5936 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
labmonkeys-space/nl6#974 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
model:sonnet phase-2-optimize runtime:claude security size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
FootprintAI/Containarium#3471 ·
Maintainer thường phản hồi trong vòng 1 ngày