結論
パーソナルアクセストークン (PAT) を取得し、actions/checkout のステップで PAT を指定する。
具体的な書き方
以下のように書きます。secrets
の登録方法は省略します*1。
- name: $ git clone する uses: actions/checkout@v3 with: token: ${{ secrets.YOUR_TOKEN }}
ハマったところ
PAT を使えば良いことはだいたい見当がつくのですが、actions/checkout で使うとはわからなかった。README に記載はあるのですが、すぐにこれにたどり着けるものなのかなあ…。
The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set persist-credentials: false to opt-out.
# Personal access token (PAT) used to fetch the repository. The PAT is configured # with the local git config, which enables your scripts to run authenticated git # commands. The post-job step removes the PAT. # # We recommend using a service account with the least permissions necessary. Also # when generating a new PAT, select the least scopes necessary. # # [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) # # Default: ${{ github.token }} token: ''
参考
*1:gh コマンド経由が楽です