GitHub Actions、YAML anchorsとJob check run ID
GitHub ActionsでYAML anchorsのサポート、non-public .githubリポジトリからのworkflow templates利用、job check run IDの追加が行われた。
- YAML anchors: workflow設定の再利用が可能、YAML仕様への準拠向上。
- Non-public workflow templates: internal/private
.githubリポジトリからworkflow templatesを利用可能。- GitHub Issuesなどは引き続き非公開リポジトリを参照出来ないため注意。
.githubが非公開の場合は、利用側も非公開である必要がある。
- Job check run ID:
job.check_run_idで現在実行中のjobを識別可能、レポートや通知、artifact管理が容易。
次はYAML anchorsの利用例。
yml
jobs:
job1:
env: &env_vars # Define the anchor on first use
NODE_ENV: production
DATABASE_URL: ${{ secrets.DATABASE_URL }}
job2:
env: *env_vars # Reuse the environment variablesyml
jobs:
test: &base_job # Define the anchor on first use
runs-on: ubuntu-latest
env:
NODE_VERSION: '18'
steps:
- uses: actions/checkout@v5
alt-test: *base_job # Reuse the entire job configurationWARNINGGitHub ActionsのYAML Anchors採用については否定的な意見も見られる。