* What went wrong:
Execution failed for task ':api:entity:annotation:publishAndroidDebugPublicationToMavenRepository'.
> Failed to publish publication 'androidDebug' to repository 'maven'
> Could not PUT 'https://maven.pkg.github.com/wantedly/visit-app-shared/com/wantedly/visit/app/shared/annotation-android-debug/0.0.2/annotation-android-debug-0.0.2.aar'. Received status code 409 from server: Conflict
#!/usr/bin/env bash# GitHub Packages frequently throws 409 errors, resulting in incomplete uploaded versions.# This is a script to remove it.# https://github.community/t/409-from-server-conflict-occurrs-when-publishing-to-github-packages/172806/17set-execho'If you encounter some permission error, run `$ gh auth login -s read:packages,delete:packages`'target_version=$1if[-z"$target_version"];thenecho"Please specify a version argument you want to delete."exit1fiecho"Trying to delete the packages that version is $target_version."packages=$(gh api graphql -fquery='
query {
repository(owner: "wantedly", name: "visit-app-shared") {
packages(first: 100) {
nodes {
name
versions(first: 10) {
nodes {
id
version
}
}
}
}
}
}
')# Extract the version IDs matching with the target version.ids=$(echo $packages | jq -r".data.repository.packages.nodes[].versions[] | flatten[] | select(.version == \"$target_version\") | .id")i=0foridin$ids;doi=$((i+1))# Using Accept header because it's a preview feature.# https://docs.github.com/en/graphql/overview/schema-previews#access-to-package-version-deletion-preview
gh api graphql -H'Accept: application/vnd.github.package-deletes-preview+json'-fquery="
mutation {
deletePackageVersion(input: {clientMutationId: \"$i\", packageVersionId: \"$id\"}) { success }
}
"done