Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: make release reminders status-only

Francesco Bonaccib79d2dbbbac4
diff --git a/.github/scripts/tests/test_release_bump_authorization.py b/.github/scripts/tests/test_release_bump_authorization.py
index c4675c9126..8e9a8099f1 100644
--- a/.github/scripts/tests/test_release_bump_authorization.py
+++ b/.github/scripts/tests/test_release_bump_authorization.py
@@ -54,6 +54,45 @@ class TestReleaseBumpAuthorization(unittest.TestCase):
)
self.assertIn("No owner-authorized release labels found", workflow)
+ def test_release_comments_cannot_authorize_or_render_release_checkboxes(
+ self,
+ ) -> None:
+ auto_release = (
+ REPO_ROOT / ".github/workflows/release-on-merge.yml"
+ ).read_text()
+ reminder = (
+ REPO_ROOT / ".github/workflows/ci-release-reminder.yml"
+ ).read_text()
+
+ auto_release_trigger = auto_release.split("permissions:", 1)[0]
+ self.assertIn("pull_request:\n types: [closed]", auto_release_trigger)
+ self.assertNotIn("issue_comment", auto_release_trigger)
+ self.assertNotIn("pull_request_review_comment", auto_release_trigger)
+ self.assertNotIn("github.event.pull_request.body", auto_release)
+ self.assertNotIn("/comments", auto_release)
+ self.assertIn(
+ "Release authorization comes only from audited label events",
+ auto_release,
+ )
+
+ reminder_trigger = reminder.split("jobs:", 1)[0]
+ self.assertNotIn("issue_comment", reminder_trigger)
+ self.assertNotIn("pull_request_review_comment", reminder_trigger)
+ self.assertNotIn("- [x]", reminder)
+ self.assertNotIn("- [X]", reminder)
+ self.assertNotIn("- [ ]", reminder)
+ self.assertIn("This comment is status-only", reminder)
+ self.assertIn(
+ "Only owner-applied \\`release:<service>\\` labels can do that",
+ reminder,
+ )
+ self.assertIn(
+ "Ask the release owner to apply \\`release:<service>\\` labels",
+ reminder,
+ )
+ self.assertIn("EXISTING_COMMENT_IDS=$(gh api --paginate", reminder)
+ self.assertNotIn("| head -1", reminder)
+
if __name__ == "__main__":
unittest.main()
diff --git a/.github/workflows/ci-release-reminder.yml b/.github/workflows/ci-release-reminder.yml
index 7966a44f97..076334ae7f 100644
--- a/.github/workflows/ci-release-reminder.yml
+++ b/.github/workflows/ci-release-reminder.yml
@@ -87,35 +87,42 @@ jobs:
COMMENT_MARKER="<!-- release-reminder -->"
BODY="${COMMENT_MARKER}\n"
BODY+="### πŸ“¦ Publishable packages changed\n\n"
+ BODY+="This comment is status-only. Editing it or adding task-list checkboxes cannot authorize a release.\n"
+ BODY+="Only owner-applied \`release:<service>\` labels can do that.\n\n"
if [ ${#LABELED[@]} -gt 0 ]; then
for svc in "${LABELED[@]}"; do
- BODY+="- [x] \`${svc}\` β€” will auto-release on merge\n"
+ BODY+="- βœ… \`${svc}\` β€” owner-authorized auto-release on merge\n"
done
fi
if [ ${#UNLABELED[@]} -gt 0 ]; then
for svc in "${UNLABELED[@]}"; do
if [ "$HAS_NO_RELEASE" = "true" ]; then
- BODY+="- [x] ~\`${svc}\`~ β€” skipped (no-release)\n"
+ BODY+="- ⏭️ ~\`${svc}\`~ β€” skipped (no-release)\n"
else
- BODY+="- [ ] \`${svc}\`\n"
+ BODY+="- ⏸️ \`${svc}\` β€” no owner-authorized release label\n"
fi
done
fi
if [ "$HAS_NO_RELEASE" = "false" ] && [ ${#UNLABELED[@]} -gt 0 ]; then
- BODY+="\nAdd \`release:<service>\` labels to auto-release on merge"
+ BODY+="\nAsk the release owner to apply \`release:<service>\` labels to auto-release on merge"
BODY+=" (+ optional \`bump:minor\` or \`bump:major\`, default is patch)."
BODY+="\nOr add \`no-release\` to skip."
fi
- # Delete previous reminder comment if exists, then post new one
- EXISTING_COMMENT_ID=$(gh api "repos/${REPO}/issues/${PR_NUMBER}/comments" \
- --jq ".[] | select(.body | contains(\"${COMMENT_MARKER}\")) | .id" 2>/dev/null | head -1)
+ # Delete every previous generated reminder, including duplicates left by
+ # older workflow runs, then post one clean status comment.
+ EXISTING_COMMENT_IDS=$(gh api --paginate \
+ "repos/${REPO}/issues/${PR_NUMBER}/comments?per_page=100" \
+ --jq ".[] | select(.body | contains(\"${COMMENT_MARKER}\")) | .id" 2>/dev/null || true)
- if [ -n "$EXISTING_COMMENT_ID" ]; then
- gh api -X DELETE "repos/${REPO}/issues/${PR_NUMBER}/comments/${EXISTING_COMMENT_ID}" 2>/dev/null || true
- fi
+ while IFS= read -r comment_id; do
+ if [ -n "$comment_id" ]; then
+ gh api -X DELETE \
+ "repos/${REPO}/issues/${PR_NUMBER}/comments/${comment_id}" 2>/dev/null || true
+ fi
+ done <<< "$EXISTING_COMMENT_IDS"
echo -e "$BODY" | gh pr comment "$PR_NUMBER" --repo "$REPO" --body-file -
diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml
index f6f9b63deb..fc79276adb 100644
--- a/.github/workflows/release-on-merge.yml
+++ b/.github/workflows/release-on-merge.yml
@@ -30,6 +30,9 @@ jobs:
PR_URL: ${{ github.event.pull_request.html_url }}
REPO: ${{ github.repository }}
run: |
+ # Release authorization comes only from audited label events. Never
+ # read PR bodies, comments, task lists, or checkbox state here.
+
# Skip everything if no-release
if echo "$LABELS" | grep -q '"no-release"'; then
echo "no-release label found, skipping."