release-drafter: ERROR: Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"}
Hi support,
I am not able to get the release tag value from release drafter. I have the following error message in github action
Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"}
{
name: 'HttpError',
id: '2187790795',
status: 422,
response: {
url: 'https://********/releases/64928231',
status: 422,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
connection: 'close',
'content-length': '193',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 21 Apr 2022 07:24:06 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-oauth-scopes': 'repo',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': '*****:62610696',
'x-oauth-scopes': 'repo, write:packages',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4964',
'x-ratelimit-reset': '1650528337',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '36',
'x-xss-protection': '0'
},
data: {
message: 'Validation Failed',
errors: [
{
resource: 'Release',
code: 'invalid',
field: 'target_commitish'
}
],
documentation_url: 'https://docs.github.com/rest/reference/repos#update-a-release'
}
},
request: {
method: 'PATCH',
url: 'https://********/releases/64928231',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'probot/12.2.1 octokit-core.js/3.5.1 Node.js/16.13.0 (linux; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"body":"## Changelog\\n* No changes\\n","draft":true,"prerelease":false,"name":"v2.0.101 ๐","tag_name":"v2.0.101","target_commitish":"refs/pull/1023/merge"}',
request: {}
},
Workflow file
jobs:
build:
runs-on: linux
if: ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
token: ******
ref: ${{ github.event.pull_request.head.sha }}
- uses: release-drafter/release-drafter@v5
id: release
env:
GITHUB_TOKEN: ****
- name: Process new_tag
id: process_new_tag
run: |
echo "new_tag=${{steps.release.outputs.tag_name}}" >> $GITHUB_ENV
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 14
- Comments: 19 (4 by maintainers)
Commits related to this issue
- :test_tube: ๋ฒ์ ๋์ด ์ ๋๋ก ์ ๋ฐ์ดํธ๋์ง ์๋ ํ์์ด ํด๊ฒฐ๋๋์ง ํ ์คํธ ์ฒ์ ๋ฆด๋ฆฌ์ฆ์ ๋ํ ๋ฌธ์ ์๋์ง๋ฅผ ํ์ธํ๊ณ ์, PRํ ๋๋ง๋ค๋ก ๋ฐ๊พธ์ด ํ ์คํธํ๋ค. ๋ค์ ๋งํฌ๋ฅผ ๋ณด๋ push๋ก๋ง ๊ฐ๋ฅํ๋ค๊ณ ํ๋ค. ๋ฐ๋ผ์ push์์ ๊ณ์ ํ ์คํธํด๋ณด๊ณ , ๋ง์ง๋ง์ ์ค์ฟผ์ํด์ผ๊ฒ ๋ค...! https://github.com/release-drafter/release... — committed to JengYoung/portfolio by JengYoung 2 years ago
- :test_tube: ๋ฒ์ ๋์ด ์ ๋๋ก ์ ๋ฐ์ดํธ๋์ง ์๋ ํ์์ด ํด๊ฒฐ๋๋์ง ํ ์คํธ ์ฒ์ ๋ฆด๋ฆฌ์ฆ์ ๋ํ ๋ฌธ์ ์๋์ง๋ฅผ ํ์ธํ๊ณ ์, PRํ ๋๋ง๋ค๋ก ๋ฐ๊พธ์ด ํ ์คํธํ๋ค. ๋ค์ ๋งํฌ๋ฅผ ๋ณด๋ push๋ก๋ง ๊ฐ๋ฅํ๋ค๊ณ ํ๋ค. ๋ฐ๋ผ์ push์์ ๊ณ์ ํ ์คํธํด๋ณด๊ณ , ๋ง์ง๋ง์ ์ค์ฟผ์ํด์ผ๊ฒ ๋ค...! https://github.com/release-drafter/release... — committed to JengYoung/portfolio by JengYoung 2 years ago
- :test_tube: Release-drafter ์๋ ํ ์คํธ ๋ญ๊ฐ ๋ฒ์ ๋์ด ์ด๊ธฐ์ ์ ๋์ง ์๋ ํ์์ด ์๋ ๋ฏํ๋ค. ์ฒ์ ๋ฆด๋ฆฌ์ฆ์ ๋ํ ๋ฌธ์ ์๋์ง๋ฅผ ํ์ธํ๊ณ ์, PRํ ๋๋ง๋ค๋ก ๋ฐ๊พธ์ด ํ ์คํธํ๋ค. ๋ค์ ๋งํฌ๋ฅผ ๋ณด๋ push๋ก๋ง ๊ฐ๋ฅํ๋ค๊ณ ํ๋ค. ๋ฐ๋ผ์ push์์ ๊ณ์ ํ ์คํธํด๋ณด๊ณ , ๋ง์ง๋ง์ ์ค์ฟผ์ํด์ผ๊ฒ ๋ค...! https://github.com/r... — committed to JengYoung/portfolio by JengYoung 2 years ago
- ci: Fix release drafter `commitish` https://github.com/release-drafter/release-drafter/issues/1125#issuecomment-1471142225 — committed to firezone/firezone by francesca64 a year ago
- ci: Fix release drafter `commitish` https://github.com/release-drafter/release-drafter/issues/1125#issuecomment-1471142225 — committed to firezone/firezone by francesca64 a year ago
- ci: Fix release drafter `commitish` https://github.com/release-drafter/release-drafter/issues/1125#issuecomment-1471142225 — committed to firezone/firezone by francesca64 a year ago
- fix(release): validation error Error: ``` Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"} ``` Fixes: https://github.com/release-drafter/release-drafter/issues/1... — committed to ZcashFoundation/zebra by gustavovalverde 9 months ago
- ref(workflows): consolidate workflows based on their purpose (#7616) * ref(workflows): consolidate workflows based on their purpose This also renames the workflows to make their naming more consiste... — committed to ZcashFoundation/zebra by gustavovalverde 8 months ago
- ref(workflows): use a single job to run GCP tests (#7682) * ref(workflows): consolidate workflows based on their purpose This also renames the workflows to make their naming more consistent and addi... — committed to ZcashFoundation/zebra by gustavovalverde 8 months ago
- use commitish option https://github.com/release-drafter/release-drafter/issues/1125 — committed to KeisukeShima/release-test by KeisukeShima 4 months ago
- commitish: main (https://github.com/release-drafter/release-drafter/issues/1125) — committed to kaoru2010/github-actions-demo00 by kaoru2010 4 months ago
- commitish: main (https://github.com/release-drafter/release-drafter/issues/1125) — committed to kaoru2010/github-actions-demo00 by kaoru2010 4 months ago
- fix release drafer error https://github.com/release-drafter/release-drafter/issues/1125 — committed to cpp-linter/.github by shenxianpeng 4 months ago
- pull_request_target does nothing, trying the other suggestion from https://github.com/release-drafter/release-drafter/issues/1125 — committed to tishun/lettuce-core by tishun 3 months ago
- Fix release drafter Use `commitish: main` as in https://github.com/release-drafter/release-drafter/issues/1125#issuecomment-1471142225 — committed to ironcore-scrapyard/test-actions by damyan 3 months ago
- Fix release drafter Use `commitish: main` as in https://github.com/release-drafter/release-drafter/issues/1125#issuecomment-1471142225 — committed to ironcore-scrapyard/test-actions by damyan 3 months ago
- ๐ Split autolabeler and release drafter This is to avoid https://github.com/release-drafter/release-drafter/issues/1125 — committed to mariusz-ostoja-swierczynski/tech-controllers by anarion80 2 months ago
To reiterate the above, itโs failing on the
pull_requestevent because the workflow is running in the context of the merge commit. Youโll see a log line like which tells you whatcommitishis and itโll look something like this:To avoid this error, either:
pull_request_targetevent instead. For security reasons, by design this will run the workflow in the context of the base of the pull request, ie:refs/heads/main. Or,commitishto point at your master/main branch, e.g. in your workflow yaml:as I said, release drafter is not able to generate drafts from a pull requests.
You could try and point the commitish to
master?@tekumara for some reason this doesnโt trigger workflow run as with
pull_requestevent.Using
commitishoption worked. Thanks.Just started seeing this same error after enabling the autolabeler. Is there a way to limit the action to only updating the draft release on PR merge while still running the autolabeler on the PR?
Guessing that the separate triggers for updating the draft release vs autolabeler is coming in v6 #1204
I met this issue today, any fix yet?