googleapis / release-please-action

automated releases based on conventional commits
Apache License 2.0
1.61k stars 207 forks source link

"Error: release-please failed: Error adding to tree" when extra-files contains a Github Action / Workflow .yml file #938

Open cwaldren-ld opened 6 months ago

cwaldren-ld commented 6 months ago

TL;DR

As part of the release process, I wanted to update a constant defined in a reusable Github workflow. If this file is added to extra-files, it causes an extremely ambiguous exception to be thrown.

For example:

"extra-files" : [
   ".github/workflows/some-workflow.yml"
]

The solution is to not try and update workflow files via release-please directly.

Expected behavior

I expected the file to be updated.

Observed behavior

The action throws an exception.

Action YAML

The release-please workflow can be found here: https://github.com/launchdarkly/lua-server-sdk/blob/main/.github/workflows/release-please.yml

Log output

Run cwaldren-ld/release-please-action@c20bc7716919838e71934160b59925db0b3e59af
Running release-please version: 16.5.0
❯ Fetching release-please-config.json from branch main
❯ Fetching .release-please-manifest.json from branch main
✔ Building releases
✔ Building strategies by path
❯ .: simple
❯ Fetching release-please-config.json from branch main
❯ Fetching .release-please-manifest.json from branch main
✔ Building pull requests
✔ Building strategies by path
❯ .: simple
✔ Collecting release commit SHAs
❯ release search depth: 400
❯ Fetching releases with cursor undefined
❯ Found release for path ., v2.0.2
❯ release for path: ., version: 2.0.2, sha: 6b434123fe7375389077f438d4a46d1b35e5fe0a
✔ Collecting commits since all latest releases
❯ commit search depth: 500
❯ Set(1) { '6b434123fe7375389077f438d4a46d1b35e5fe0a' }
❯ Fetching merge commits on branch main with cursor: undefined
✔ Splitting 18 commits by path
✔ Building candidate release pull request for path: .
❯ type: simple
❯ targetBranch: main
❯ commits: 18
✔ Considering: 18 commits
❯ component: 
❯ pull request title pattern: undefined
✔ Looking for open release pull requests
✔ found 0 open release pull requests.
✔ Looking for snoozed release pull requests
✔ found 0 snoozed release pull requests.
❯ Fetching CHANGELOG.md from branch main
❯ Fetching version.txt from branch main
⚠ file version.txt did not exist
❯ Fetching launchdarkly-server-sdk.c from branch main
❯ Fetching .github/workflows/rockspec-info.yml from branch main
⚠ No entries modified in $.version
❯ Fetching README.md from branch main
❯ Fetching scripts/update-versions.sh from branch main
❯ Fetching scripts/compile.sh from branch main
❯ Fetching .release-please-manifest.json from branch main
✔ Starting GitHub PR workflow...
✔ Successfully found branch HEAD sha "85cdab131e99e47c0d7985406052100b82aa685b".
✔ Skipping branch creation step...
✔ Got the latest commit tree
✔ Here's the error message: Resource not accessible by integration
✔ Here's the status: 403
✔ Here's the docs URL: undefined
Error: release-please failed: Error adding to tree: 85cdab131e99e47c0d7985406052100b82aa685b: HttpError: Resource not accessible by integration

Additional information

Note: in the log output, I had to fork the action and add extra debug logs. This is because the action doesn't log the actual Github error that is returned in the "Error adding to tree: " condition.

See here for (what I believe is) the underlying cause of the error: https://github.com/orgs/community/discussions/35410#discussioncomment-7645702