Hi Graphite team! My team is implementing Graphite...
# report-bugs
m
Hi Graphite team! My team is implementing Graphite and part of the requirements include installing the
dismiss stale pull request
GitHub action, to avoid having to re-approve sub-stacks after rebasing. However, every time we merge a base stack, and rebase the subsequent stacks, all previous approvals are dismissed by the GitHub action with the following message:
Latest workflow ID:
jq: invalid JSON text passed to --argjson
Use jq --help for help with command-line options,
or see the jq manpage, or online docs at https://jqlang.github.io/jq
Failed to parse GitHub response with jq:
(url: https://api.github.com/repos/repo/repo/actions/workflows//runs?status=success&branch=task/foo)
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest",
"status": "404"
}
Notice: No previous SHAs found; behaving as if diff has changed
After some investigation I noticed 2 issues with the
latest_artifact.sh
script: 1. The
||
in line
20
is not working as expected:
Copy code
latest_workflow_id=$(echo ${workflows} \
	| jq \
		--arg workflow_name "$workflow_name" \
		'.workflows[] | select(.name==$workflow_name).id' || echo "ERROR")
The
jq
command is returning an empty string, causing the
||
not to take effect. This results in
latest_workflow_id
to be an empty string and form a bad url in the following CURL request on line
36
The solution would be to have something like this instead:
Copy code
maybe_latest_workflow_id=$(echo ${workflows} \
	| jq \
		--arg workflow_name "$workflow_name" \
		'.workflows[] | select(.name==$workflow_name).id')

latest_workflow_id=${maybe_latest_workflow_id:-"ERROR"}
2. The 3rd argument expected by the
latest_artifact.sh
script is the PR number, which is extracted from
echo graphite-base/12345 | cut -d '/' -f 1)
This however, will return the first part of the string, in this case
graphite-base
instead of the pr number. Instead the command should be
echo graphite-base/12345 | cut -d '/' -f 2)
Let me know if I'm missing something, or if this is expected behavior Thanks!
👀 1
p
(If applicable) To help us repro, please send the following if you haven't already: - PR links, screenshots, and/or debug output if applicable - Repro steps - Does this happen consistently? Just to you or others on your team also? - Is this a regression? Is the problem new? - If you're having an issue with the CLI, please send us debug logs using
gt feedback --with-debug-context <any message>
m
To reproduce this issue, you need to change the
per_page
param in the Github get workflows api and make sure the desired workflow is in one of the next pages. Let me know if you need anything else, or if it's better for me to fork the project and create the fix. Thanks!
p
hey Marcial, stumbled on this thread of yours. If you want feel free to fork and make PRs for the dismiss-stale-approvals repo. You can let me know and I'll get them in front of the right engineer for review 👍