action-gh-release
action-gh-release copied to clipboard
Getting 422 "already_exists" error on 2.2.2
After upgrading we get this error in our output.
Run softprops/[email protected]
with:
target_commitish: c75edc7a731e637485d4a6bb7f707e7ba95f38e3
tag_name: [email protected]
append_body: true
body: [...]
token: ***
env:
COMMITS: [...]
👩🏭 Creating new GitHub release for tag [email protected] using commit "c75edc7a731e637485d4a6bb7f707e7ba95f38e3"...
⚠️ GitHub release failed with status: 422
{"message":"Validation Failed","errors":[{"resource":"Release","code":"already_exists","field":"tag_name"}],"documentation_url":"https://docs.github.com/rest/releases/releases#create-a-release","status":"422"}
Skip retry - validation failed
⚠️ Unexpected error fetching GitHub release for tag refs/heads/main: HttpError: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"} - https://docs.github.com/rest/releases/releases#create-a-release
Error: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"} - https://docs.github.com/rest/releases/releases#create-a-release
This is the action:
publish_release:
name: ✨ Publish Release
runs-on: ubuntu-latest
steps:
- [...]
- name: ✨ Publish Release
uses: softprops/[email protected]
with:
target_commitish: ${{ inputs.sha }}
tag_name: ${{ inputs.name }}
body: |-
## Changes made in Release ${{ inputs.name }}
- [...]
Any idea what is going on?
same
same
Duplicate of #613?
@RadxaYuntian not duplicate, me fails on uploading release assets either.
I am having same issue!!!!
I have to change my actions to use this version 2.2.1
- name: Upload Release
uses: softprops/[email protected]
with:
draft: false
prerelease: false
tag_name: ${{ github.run_number }}
body: ${{ github.event.head_commit.message }}
files: ${{ github.workspace }}\filename.dll
env:
GITHUB_TOKEN: ${{ github.token }}
then my actions is working again.
2.3.2 has the same issue. Last working version is 2.2.1
Did everyone use matrix to create releases in parallel? I suspect it's a concurrency issue.
Did everyone use
matrixto create releases in parallel? I suspect it's a concurrency issue.
Yes, it's definitely a concurrency issue
yeah we use matrix because we need to build for different architectures...
@chenrui333 any idea how to mitigate. Maybe with a retry?
@sruehl we have worked around this issue with a two-step process.
First step (not matrixed) is publishing a draft: true release and second step is to use the matrix strategy with draft: false so there will always be a release for the second steps and we avoid the race condition.
We just ran into this for the first time as well with 2 workflows running in parallel, one using 2.2.1 and the other 2.0.0. I'm guessing it's just a race condition. One of the 2 should try to update the release, but they don't because when they check if it exists neither has created it yet.
Perhaps the workflow simply shouldn't skip retrying on 422's?
I changed my workflow to create a draft first, then it's not an issue when the race condition occurs, as a workaround
http422-retry-count: 2 can it not just wait 20 seconds and retry, only when HTTP/422, upto the limit specified. A value of 2 such as this example would try a total of 3 times with approx 60 seconds of total waiting until a fatal error is given as now.
http422-retry-count: 0 means never and is the default.
Trying to make this easier to understand (untested):
- name: Release
id: release1
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE-NOTES.txt
files: myfile.exe
- name: wait1
if: failure()
shell: bash
run: sleep 20
- name: Release 2
id: release2
if: steps.release1.outcome != 'success'
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE-NOTES.txt
files: myfile.exe
- name: wait2
if: failure()
shell: bash
run: sleep 20
- name: Release 3
id: release3
if: steps.release1.outcome != 'success' && steps.release2.outcome != 'success'
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE-NOTES.txt
files: myfile.exe
released @stephenway's fix in v2.3.4