【GitHub Actions】actions/checkout には persist-credentials: false を設定するべき
ARANK
結論actions/checkout アクションを使用する際は、persist-credentials: false を設定するべきです。- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: # ↓これ persist-credentials: false # デフォルトは true なんで?後続ステップからファイル経由であっさり GitHub トークンを抜き取れてしまうので。.github/workflows/example.ymlon: push jobs: example: runs-on: ubuntu-latest steps: # persist-credentials 未設定 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # `${{ github.token }}`, `${{ secrets.GITHUB_TOKEN }}` を使用せずに # ファイル経由で GitHub トークンを抜き取る - run: GH_TOKEN=$( cat "$RUNNER_TEMP"/git-credentials-*.config \ awk 'NR==2 {print $5}' \ base64 --decode \ cut -d: -f2 ) # 最初の 10 文字だけ出力 echo "github token: ${GH_TOKEN:0:10}..." 実行ログもし使用しているリモートアクションが…