Skip to content

Fix triggering workflows - #13

Open
dscho wants to merge 3 commits into
mainfrom
fix-triggering-workflows
Open

dscho wants to merge 3 commits into
mainfrom
fix-triggering-workflows

Conversation

@dscho

@dscho dscho commented Dec 1, 2026

Copy link
Copy Markdown
Member

I just tried to trigger a workflow in a sister GitHub App, and it failed.

Turns out that the API advanced in a way that is incompatible with what we started using. Let's fix that, and while at it, no longer just use the latest API version but instead pin it.

This is a companion of git-for-windows/gfw-helper-github-app#267.

This used to be needed to get _some_ information back, but now it no
longer works:

	"return_run_details" is not an object

Seems that the newest API version silently dropped this flag.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
dscho force-pushed the fix-triggering-workflows branch from 8a730bf to c068ec7 Compare December 1, 2026 14:12
@dscho

dscho commented Dec 1, 2026 •

Copy link
Copy Markdown
Member Author

Funnily enough, this slash command worked... even before merging this PR...

We just got surprised with a failure due to an update in the API
version: When triggering workflows, the `return_run_details` flag, which
used to be required, now triggers an error.

Let's avoid getting such nasty surprises by specifying which API version
we target.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
dscho force-pushed the fix-triggering-workflows branch from c068ec7 to 36fbbff Compare December 1, 2026 14:42
body,
{
Authorization: `Bearer ${token}`,
'X-GitHub-Api-Version': '2026-03-10',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is only used in two places but could it be environment controlled? An env var could set the supported api version without a code change. Would that require more changes when a level set is needed?

Since the api change has been addressed, is version locking needed? Should we wait for the next break given the api usage is so basic?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would be a good idea to have this controlled by the environment because any API version change will require code changes. For example, the return_run_details attribute to trigger workflow dispatches. That is no longer supported by this new API version. So if we just allow the API version to be overridden, the code might have wrong assumptions about what it can and cannot do.

@dscho

dscho commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

I think I misinterpreted the situation that was fixed by the corresponding PR. I thought the API had changed, but what is much more likely based on my recent understanding is that we sent an incomplete request that wasn't even correct JSON.

On GitHub's side it did not reject that as invalid JSON, but still tried to interpret the truncated value, which was no longer true but instead tru.

Here is the actual fix for that recent problem, which I plan on porting to GitGitGadget, too:

git-for-windows/git-for-windows-automation@8ca6bfd

Workflow-dispatch inputs can contain non-ASCII text. JSON containing
such text may require more UTF-8 bytes than its JavaScript string
length. Understating Content-Length can leave GitHub with incomplete
JSON, which the API can reject.

Git for Windows Automation previously fixed the same problem:
git-for-windows/git-for-windows-automation@8ca6bfd

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho

dscho commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Here is the actual fix for that recent problem, which I plan on porting to GitGitGadget, too:

git-for-windows/git-for-windows-automation@8ca6bfd

And I added a corresponding fix to this PR.

dscho added a commit to git-for-windows/gfw-helper-github-app that referenced this pull request Dec 4, 2026
A non-ASCII workflow input can make `Content-Length` smaller than the
UTF-8 request body and leave GitHub with truncated JSON.

This follows up the merged changes (with the _actual_ fix for the bug)
in #267 and
matches gitgitgadget/gitgitgadget-github-app#13.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants