GITHUB_REPOSITORY とは?
GITHUB_REPOSITORY はワークフローを実行しているリポジトリの owner/repo 識別子です。
GITHUB_REPOSITORY はイメージ名の構築、GitHub API の呼び出し、現在のリポジトリを参照する URL の組み立てに便利です。
一般的な用途
- コンテナイメージに名前を付ける:
ghcr.io/$GITHUB_REPOSITORY - API URL を構築する
- パラメータ展開で owner と repo を分割する
例
このリポジトリの GitHub Container Registry のパスに push します。
shell
docker push ghcr.io/${GITHUB_REPOSITORY}:latest重要なポイント
- GITHUB_REPOSITORY は
owner/repoです。 - イメージ名や API URL に最適です。
- GITHUB_REPOSITORY_OWNER は owner だけを返します。
関連ガイド
What Is GITHUB_REPOSITORY_OWNER?GITHUB_REPOSITORY_OWNER is the user or organization that owns the repo in a GitHub Actions run. Learn how it…
What Is GHCR? GitHub Container Registry ExplainedGHCR is GitHub Container Registry, hosting images under ghcr.io tied to GitHub identities. Learn how auth, pe…