feat: setup-task GitHub Action の初回実装#6
Conversation
📝 WalkthroughSummary by CodeRabbitリリースノート
Walkthrough
Changessetup-task GitHub Action 実装
Sequence Diagram(s)sequenceDiagram
actor Runner as GitHub Actions Runner
participant main as main.ts
participant github as github.ts (createReleaseApi)
participant version as version.ts (resolveVersion)
participant tc as tool-cache
participant download as download.ts (downloadAsset)
participant checksum as checksum.ts (verifyChecksum)
participant install as install.ts (extract)
Runner->>main: action 起動(inputs: version, repo-token, ...)
main->>github: createReleaseApi(token)
main->>version: resolveVersion(api, versionInput) [withRetry]
version->>github: getLatestVersion() or listStableVersions()
github-->>version: tag_name / stable list
version-->>main: resolved version tag
main->>tc: find(TOOL_NAME, version)
alt cache hit
tc-->>main: cached dir path
else cache miss
main->>download: downloadAsset(releaseDownloadUrl, token) [withRetry]
download-->>main: tmpPath
main->>checksum: fetchChecksum(tag, assetName, token)
checksum-->>main: expected SHA256
main->>checksum: verifyChecksum(tmpPath, expected)
checksum-->>main: ok / PermanentError
main->>install: extract(tmpPath, ext)
install-->>main: extracted dir
main->>tc: cacheDir(dir, TOOL_NAME, version)
end
main->>Runner: core.addPath + core.setOutput(version/task-path/cache-hit)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7b526ee to
84267ad
Compare
go-task (task) バイナリを解決→取得→検証→展開→キャッシュ→PATH 追加する Node 24 製 Action。 バージョン解決 (exact/range/latest)、プラットフォーム判定、認証付き DL + 指数バックオフ、 SHA256 チェックサム検証、tool-cache、outputs を実装 (FR-1〜FR-10)。 dist/ はバンドル済みでコミット。CI/self-test ワークフロー、ユニットテスト、ドキュメント同梱。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84267ad to
6e236a6
Compare
There was a problem hiding this comment.
3 issues found across 32 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
対応表に riscv64 があるのに ARCH_MAP が未対応で、riscv64 Linux ランナーの自動判定が throw していた(Codex/cubic 指摘)。回帰テストを追加。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
checksums URL が HTML エラーページ(レート制限ページ)を返すと、checksum not found で hard fail しリトライされなかった。content-type に html を含む場合は transient エラーとして throw。tests/github.test.ts を新規追加(Codex 指摘3)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
errors.ts の設計(checksum 不一致は恒久エラー)に反し素の Error を投げていた。PermanentError に揃え、回帰テストで型を検証(cubic 指摘)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- github: fetchJson/fetchText の共通プロローグを fetchOk + guardContentType に集約(各セマンティクスは維持) - errors: errorMessage(err) を新設し download/main のインライン重複を解消 - main: cacheHit を const 化し no-op 再代入を削除 - platform: trim 後に冗長な length>0 を除去 (/simplify 由来・挙動不変) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
要求仕様書.md (1)
162-166: 💤 Low valueコード block に言語指定を追加してください。
markdownlint (MD040) の要件に準拠するため、YAML コード block に言語指定を追加してください。
💚 修正案
-``` +```yaml runs: using: "node24" # CON-1 main: "dist/index.js" -``` +```🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@要求仕様書.md` around lines 162 - 166, The YAML code block in the markdown file does not have a language identifier specified, which violates the markdownlint MD040 rule. To fix this, add the language identifier "yaml" immediately after the opening triple backticks of the code block (the line starting with ``` that precedes the "runs:" line), changing it from ``` to ```yaml to properly declare the code block language.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@要求仕様書.md`:
- Around line 162-166: The YAML code block in the markdown file does not have a
language identifier specified, which violates the markdownlint MD040 rule. To
fix this, add the language identifier "yaml" immediately after the opening
triple backticks of the code block (the line starting with ``` that precedes the
"runs:" line), changing it from ``` to ```yaml to properly declare the code
block language.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 759993c0-9f99-4e3d-84bc-b4c555f5eaa0
⛔ Files ignored due to path filters (12)
.claude/settings.jsonis excluded by!**/*.json.github/dependabot.ymlis excluded by!**/*.yml.github/workflows/ci.ymlis excluded by!**/*.yml.github/workflows/self-test.ymlis excluded by!**/*.ymlaction.ymlis excluded by!**/*.ymldist/index.jsis excluded by!**/dist/**,!dist/**dist/index.js.mapis excluded by!**/dist/**,!**/*.map,!dist/**,!**/*.mapdist/licenses.txtis excluded by!**/dist/**,!dist/**dist/sourcemap-register.jsis excluded by!**/dist/**,!dist/**package-lock.jsonis excluded by!**/package-lock.json,!**/*.jsonpackage.jsonis excluded by!**/*.jsontsconfig.jsonis excluded by!**/*.json
📒 Files selected for processing (21)
.gitignoreCLAUDE.mdLICENSEREADME.mdTODO.mdeslint.config.mjssrc/checksum.tssrc/constants.tssrc/download.tssrc/errors.tssrc/github.tssrc/install.tssrc/main.tssrc/platform.tssrc/version.tstests/checksum.test.tstests/github.test.tstests/platform.test.tstests/version.test.ts企画書.md要求仕様書.md
概要
go-task (
task) バイナリをインストールする GitHub Action のプロジェクト基盤・初回実装。arduino/setup-taskのドロップイン代替を目指す(Node 24 / 認証既定 / checksum 検証 / cache)。含まれるもの
src/): バージョン解決 (exact/range/latest)、プラットフォーム判定、認証付き DL + 指数バックオフ、SHA256 検証、tool-cache、PATH 追加、outputs — FR-1〜FR-10dist/: ncc バンドル済み(Action はdist/index.jsを直接実行するためコミット)dist/鮮度チェック、OS×version マトリクスREADME.md/CLAUDE.md/TODO.md/ 企画書・要求仕様書テスト
npm run all(typecheck + lint + test + build)green補足
v1.0.0([security] repo-token を core.setSecret でログから秘匿する #1〜[test] cache-hit 経路の self-test を追加する #5)で別途対応し、本 PR では close しない。.diag.txt/.claude/は.gitignoreで除外。🤖 Generated with Claude Code
Summary by cubic
Initial implementation of
setup-task: a Node 24 GitHub Action that installs the Task (go-task) binary with authenticated downloads, SHA256 verification, caching, and retries. A drop-in alternative toarduino/setup-taskwith exact/range/latest version support and platform detection.Bug Fixes
process.arch=riscv64to the correct go-task asset; tests added.fetchTexttreats HTML pages as transient and retries; checksum mismatches throwPermanentError.Refactors
fetchOk+ content-type guards; addederrorMessage; minor cleanups (cacheHitconst, input trim).Written for commit 9e33762. Summary will update on new commits.