以前からrelease-drafterを使っていて、新しく作ったリポジトリにも導入したいと考えて導入したところ以下のエラーが発生した
ERROR: Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"}
調べると以下のissueを発見した github.com
読んでいるとメインブランチがmaster
でない場合に発生する事象みたい
I had the same issue and have an easy fix. Maybe it can work for you.
New Github repositories do not have "master" as first branch but "main". Since I just wanted to test the Github action I copied the yml file from the marketplace: https://github.com/marketplace/actions/release-drafter with "master".
The error could be catched and explained ^^
https://github.com/release-drafter/release-drafter/issues/1125#issuecomment-1397155730
確かに以前に導入した時はmaster
がデフォルトのメインブランチになるが、最近はmain
ブランチがデフォルトのメインブランチのため、その違いによって起こったみたい
ということで、メインブランチを変えることにした
公式のREADMEを見るとcommitish
というオプションで設定できるとわかったので、workflow/release-drafter.yml
を以下のように書き換えたら無事動いた
- uses: release-drafter/release-drafter@v5 # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml # with: # config-name: my-config.yml # disable-autolabeler: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: commitish: main