pr-cleanup.yml のパッケージ名解決とエラーハンドリングを修正#10
Merged
Conversation
- GHCR のパッケージ名は ghcr.io/<owner>/ 以降のパス全体 (<repo>/acms-dev)になる。acms-dev 単体では 404 になっていた (匿名レジストリAPIで実在パスを確認して特定)。 - パッケージ名の "/" は API パスで %2F にエンコードするよう修正。 - gh api の失敗(404等)をエラー本文のまま jq に流し込んでいたため jq: Cannot index string with string 'metadata' という分かりにくい クラッシュになっていた。exit code を明示チェックし、失敗時は ::warning:: で理由を出して安全にスキップするよう修正。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
PR #9 のマージ時に
pr-cleanup.ymlが失敗した。原因
ghcr.io/<owner>/acms-development-docker-images/acms-devなので、GHCR 上のパッケージ名はacms-dev単体ではなくacms-development-docker-images/acms-dev(リポジトリ名込みのパス)。匿名レジストリAPIで実在パスを確認して特定した。gh apiが 404 のエラー本文(JSON オブジェクト)をそのまま jq に渡していたため、.[]がオブジェクトの値(文字列)を返し、.metadataアクセスで意味不明なクラッシュになっていた。修正内容
PACKAGE_NAMEを${{ github.event.repository.name }}/acms-devに変更(リポジトリ改名にも自動追従)/を API パスで%2Fにエンコードgh apiの exit code を明示チェックし、失敗時は::warning::を出して安全にスキップ(jq クラッシュを防止)検証
actionlint通過appleple/acms-development-docker-images/acms-devが実在パス(UNAUTHORIZED= 存在するが非公開)であることを確認。appleple/acms-dev単体はNAME_UNKNOWN(存在しない)だったことも確認済み補足(別途要確認)
GHCR パッケージが private の可能性が高い(GitHub の既定挙動)。PR プレビューを外部レビュアーが
docker pullできる想定なら、Package の Visibility を Public に変更する必要がある。🤖 Generated with Claude Code