fix: enforce share authorization boundary (#3022)
This commit is contained in:
@@ -363,6 +363,17 @@ class PRWalkthroughWorkflowContractTest(unittest.TestCase):
|
||||
self.assertNotIn("OPENCODE_API_KEY", self.link)
|
||||
self.assertTrue(PR_BODY_HELPER.is_file())
|
||||
|
||||
def test_link_job_retries_transient_github_api_responses(self) -> None:
|
||||
for value in (
|
||||
"pr_response_ok=false",
|
||||
"for attempt in 1 2 3; do",
|
||||
"python3 -c 'import json; json.load(open(\"pr-response.json\", encoding=\"utf-8\"))'",
|
||||
'test "$pr_response_ok" = true',
|
||||
"patch_ok=false",
|
||||
'test "$patch_ok" = true',
|
||||
):
|
||||
self.assertIn(value, self.link)
|
||||
|
||||
def test_lint_workflow_runs_contract_and_body_helper_tests(self) -> None:
|
||||
lint_workflow = LINT_WORKFLOW.read_text(encoding="utf-8")
|
||||
for command in (
|
||||
|
||||
@@ -392,7 +392,18 @@ jobs:
|
||||
test -f scripts/pr-walkthrough-pr-body
|
||||
test -n "$PUBLIC_URL"
|
||||
|
||||
gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" > pr-response.json
|
||||
pr_response_ok=false
|
||||
for attempt in 1 2 3; do
|
||||
if gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" > pr-response.json &&
|
||||
python3 -c 'import json; json.load(open("pr-response.json", encoding="utf-8"))'; then
|
||||
pr_response_ok=true
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -lt 3 ]; then
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
test "$pr_response_ok" = true
|
||||
|
||||
set +e
|
||||
python3 scripts/pr-walkthrough-pr-body \
|
||||
@@ -410,8 +421,18 @@ jobs:
|
||||
fi
|
||||
test "$update_status" -eq 0
|
||||
|
||||
gh api --method PATCH \
|
||||
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" \
|
||||
--input pr-update.json \
|
||||
--silent
|
||||
patch_ok=false
|
||||
for attempt in 1 2 3; do
|
||||
if gh api --method PATCH \
|
||||
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" \
|
||||
--input pr-update.json \
|
||||
--silent; then
|
||||
patch_ok=true
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -lt 3 ]; then
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
test "$patch_ok" = true
|
||||
echo "Added the walkthrough link to the top of the PR description." >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
Reference in New Issue
Block a user