Skip to content

feat: add workflow to review PRs labeled with GFI and Beginner#1828

Draft
tech0priyanshu wants to merge 5 commits intohiero-ledger:mainfrom
tech0priyanshu:feat/GFI_Beginner_triage
Draft

feat: add workflow to review PRs labeled with GFI and Beginner#1828
tech0priyanshu wants to merge 5 commits intohiero-ledger:mainfrom
tech0priyanshu:feat/GFI_Beginner_triage

Conversation

@tech0priyanshu
Copy link
Contributor

@tech0priyanshu tech0priyanshu commented Feb 20, 2026

Description:

Related issue(s): need triage review for pr with GFI and beginner

Fixes #1721

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@tech0priyanshu tech0priyanshu requested a review from a team as a code owner February 20, 2026 20:05
Copilot AI review requested due to automatic review settings February 20, 2026 20:05
@tech0priyanshu tech0priyanshu requested a review from a team as a code owner February 20, 2026 20:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds GitHub Actions automation intended to involve the triage community when PRs are labeled as beginner/GFI, and documents the change in the changelog.

Changes:

  • Add a new workflow that triggers on PR label events for “Good First Issue” / “Beginner”.
  • Add a changelog entry describing the new workflow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
CHANGELOG.md Documents the addition of a new PR triage-review workflow.
.github/workflows/request-triage-review.yml Introduces a workflow meant to request triage review based on PR labels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const prNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const team_reviewers = ['triage'];
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

team_reviewers is set to ['triage'], but elsewhere in this repo the triage team is referenced as @hiero-ledger/hiero-sdk-python-triage (team slug likely hiero-sdk-python-triage). If this slug is wrong, the API call will fail at runtime. If the intended behavior is to @mention a triage member in a comment (per issue #1721), this team slug should be removed entirely in favor of a roster-based username mention.

Suggested change
const team_reviewers = ['triage'];
const team_reviewers = ['hiero-sdk-python-triage'];

Copilot uses AI. Check for mistakes.

### Added

- GitHub Actions workflow to review pull requests labeled with `GFI` and `Beginner`. (`#1721`)
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

This changelog entry says PRs labeled with GFI, but the automation in this repo (and the new workflow) uses the label name Good First Issue. To avoid confusion, update the wording to match the actual label(s) the workflow responds to. Also, workflow/bot changes in this changelog are typically recorded under the ### .github section rather than the top-level ### Added section.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +29
script: |
const prNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const team_reviewers = ['triage'];
await github.rest.pulls.requestReviewers({
owner,
repo,
pull_number: prNumber,
team_reviewers,
});
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

This workflow calls pulls.requestReviewers, which assigns review requests to a team. The linked issue/PR description explicitly says this bot should not assign reviewers (to avoid conflicts with other bots) and should instead post a PR comment that @mentions a selected triage member (ideally chosen from a repo-managed roster). Consider replacing the reviewer request with issues.createComment on the PR (issue) and selecting a triage member from a checked-in list (e.g., a roster file in .github/).

Copilot uses AI. Check for mistakes.
name: Request triage review on beginner PRs

on:
pull_request:
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

Using the pull_request event will not grant write permissions on PRs from forks, so this job will typically be unable to comment/request anything on many beginner/GFI PRs (which are often from forks). Existing PR-commenting bots in this repo use pull_request_target and only check out the base branch to stay safe while retaining write permissions; consider switching to pull_request_target with similar safeguards.

Suggested change
pull_request:
pull_request_target:

Copilot uses AI. Check for mistakes.
runs-on: ubuntu-latest
steps:
- name: Request review from triage team
uses: actions/github-script@v7
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

Action versions are not pinned (e.g., actions/github-script@v7). This repo consistently pins actions to a full commit SHA (and often hardens the runner) to reduce supply-chain risk; please align this workflow with that convention (see other workflows under .github/workflows/ for examples).

Suggested change
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea

Copilot uses AI. Check for mistakes.

jobs:
request-triage:
if: ${{ github.event.label && (github.event.label.name == 'Good First Issue' || github.event.label.name == 'Beginner') }}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The label check is case-sensitive and only matches exactly 'Good First Issue' or 'Beginner'. Other automation in this repo treats difficulty labels case-insensitively (and sometimes uses lowercase beginner), so this workflow may silently not run depending on label casing. Consider normalizing to lowercase in the condition or checking against a list of accepted variants.

Suggested change
if: ${{ github.event.label && (github.event.label.name == 'Good First Issue' || github.event.label.name == 'Beginner') }}
if: ${{ github.event.label && (toLower(github.event.label.name) == 'good first issue' || toLower(github.event.label.name) == 'beginner') }}

Copilot uses AI. Check for mistakes.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a GitHub Actions workflow, a helper script, and a changelog entry to post a triage-request comment on PRs labeled "Good First Issue" or "Beginner" (or run manually). The script reads triage reviewers from a repo file or env, supports dry-run, checks idempotency, and posts comments via the GitHub API.

Changes

Cohort / File(s) Summary
Workflow
.github/workflows/request-triage-review.yml
New GitHub Actions workflow "Request triage review on beginner PRs": triggers on pull_request_target label events and workflow_dispatch, sets concurrency and scoped permissions, and runs a job that invokes the triage-comment script when the PR label is Good First Issue or Beginner.
Script
.github/scripts/bot-pr-gfi-review-triage.sh
New shell script that validates environment variables, extracts the PR number from the event payload, reads triage reviewers from .github/triage-reviewers.txt or TRIAGE_REVIEWERS, enforces idempotency via a marker comment, supports dry-run, and posts a comment to request triage review using the GitHub API (curl + jq).
Changelog
CHANGELOG.md
Adds an "Added" changelog entry documenting the new triage review automation (references issue #1721).

Sequence Diagram(s)

sequenceDiagram
    participant PR as "Pull Request"
    participant Workflow as "GitHub Actions\n(request-triage-review)"
    participant Script as "bot-pr-gfi-review-triage.sh"
    participant TriageList as ".github/triage-reviewers.txt\nor TRIAGE_REVIEWERS"
    participant GitHub as "GitHub API"
    participant Reviewer as "Selected triage member"

    PR->>Workflow: label added ("Good First Issue"/"Beginner") or manual dispatch
    Workflow->>Script: run script (env: GITHUB_EVENT_PATH, GITHUB_TOKEN, GITHUB_REPOSITORY, DRY_RUN)
    Script->>TriageList: read reviewers (file or env)
    Script->>GitHub: GET /repos/:owner/:repo/issues/:number/comments (check marker)
    GitHub-->>Script: comments list
    alt marker not present and not dry-run
        Script->>GitHub: POST /repos/:owner/:repo/issues/:number/comments (mention selected reviewer)
        GitHub-->>Script: 201 Created (comment id)
        Script->>Reviewer: notify via comment mention
    else marker present or dry-run
        Script-->>Workflow: no-op or preview output
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements a workflow to request triage reviews for GFI/Beginner PRs, posts comments with triage member mentions, and extracts configurable variables; however, it uses .github/triage-reviewers.txt instead of the required .github/triage-members.txt file. Rename the triage member list file from triage-reviewers.txt to triage-members.txt as specified in issue #1721, or ensure the script uses the correct file path.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a workflow to review PRs labeled with GFI and Beginner.
Description check ✅ Passed The description is related to the changeset and references the linked issue #1721; it documents the workflow addition for triage review requests.
Out of Scope Changes check ✅ Passed All changes are in scope: workflow definition, triage bot script, and changelog entry directly support the issue #1721 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Comment on lines +7 to +9
permissions:
contents: read
pull-requests: write
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

contents: read is unused; the correct implementation will also need issues: write.

  • contents: read is unnecessary in the current implementation (no checkout). Once corrected to read .github/triage-members.txt it will be needed, but should be justified by a checkout step.
  • Posting a comment via issues.createComment requires issues: write, which is absent. The pull-requests: write covers reviewer requests but not PR comments.
🔒 Proposed correction (for the intended behavior)
 permissions:
   contents: read
+  issues: write
-  pull-requests: write

As per coding guidelines: "Requested permissions MUST exactly match behavior" and "Explicitly validate common cases: issues: write → comments."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
permissions:
contents: read
pull-requests: write
permissions:
contents: read
pull-requests: write
issues: write

runs-on: ubuntu-latest
steps:
- name: Request review from triage team
uses: actions/github-script@v7
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all uses of actions/github-script to check pinning patterns
rg -n "actions/github-script" --type yaml -A 1 -B 1

Repository: hiero-ledger/hiero-sdk-python

Length of output: 55


🏁 Script executed:

#!/bin/bash
# Read the workflow file to see full context around line 17
cat -n .github/workflows/request-triage-review.yml | head -40

Repository: hiero-ledger/hiero-sdk-python

Length of output: 1184


🏁 Script executed:

#!/bin/bash
# Check all third-party actions in all workflow files to understand pinning patterns
rg -n "^\s+uses:\s+" .github/workflows/ --type yaml | head -30

Repository: hiero-ledger/hiero-sdk-python

Length of output: 3898


🌐 Web query:

actions/github-script v7.0.1 commit SHA

💡 Result:

actions/github-script@v7.0.1 points to commit SHA:

60a0d83039c74a4aee543508d2ffcb1c3799cdea [1][2]


Pin actions/github-script to a full commit SHA.

Line 17 uses @v7 (a mutable tag), which violates the Priority 0 requirement that all third-party actions be pinned to full commit SHAs. The tag can be silently moved to point to different — potentially malicious — code. All other workflows in this repo use SHA-pinned actions.

Fix
-        uses: actions/github-script@v7
+        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

Comment on lines +19 to +29
script: |
const prNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const team_reviewers = ['triage'];
await github.rest.pulls.requestReviewers({
owner,
repo,
pull_number: prNumber,
team_reviewers,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Business logic must be extracted to .github/scripts/.

The script: | block contains all the workflow's logic inline in YAML. Per Priority 4, non-trivial logic — especially multi-line JS involving API calls — must live in a dedicated .github/scripts/request-triage-review.js file. YAML should only orchestrate the call:

- name: Request review from triage team
  uses: actions/github-script@<SHA> # v7.0.1
  with:
    script: |
      const script = require('./.github/scripts/request-triage-review.js');
      await script({ github, context, core });

As per coding guidelines: "All non-trivial logic MUST live in .github/scripts/*.sh or .github/scripts/*.js" and "YAML should orchestrate execution only."


⚠️ Potential issue | 🟡 Minor

No structured logging — decisions and context are invisible in the workflow run.

The script produces no log output. Per Priority 8, at minimum the following should be logged: PR number, label that triggered the run, dry-run status, and whether an action was taken or skipped (e.g., duplicate detection).

Add core.info(...) calls in the extracted .github/scripts/ file to surface key decisions.

As per coding guidelines: "Logs should include PR number, triggering actor, dry-run status, decisions made (performed vs skipped)" and "Avoid: Silent success or silent skips."

Comment on lines +30 to +31
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's find and view the workflow file
find . -name "request-triage-review.yml" -type f

Repository: hiero-ledger/hiero-sdk-python

Length of output: 118


🏁 Script executed:

# Get the full context of the workflow file to understand the github-script usage
cat -n ".github/workflows/request-triage-review.yml" 2>/dev/null || echo "File not found"

Repository: hiero-ledger/hiero-sdk-python

Length of output: 1184


🏁 Script executed:

# Search for all github-script usages in workflows to see how other workflows handle authentication
rg -n "uses: actions/github-script" --type yaml -A5

Repository: hiero-ledger/hiero-sdk-python

Length of output: 55


🏁 Script executed:

# Check if the script section references GITHUB_TOKEN env var
rg -n "GITHUB_TOKEN" --type yaml .github/workflows/

Repository: hiero-ledger/hiero-sdk-python

Length of output: 2684


Remove redundant env: GITHUB_TOKENactions/github-script authenticates via the github-token input parameter, not via environment variables.

actions/github-script@v7 uses its github-token input to authenticate the github client object (defaulting to ${{ github.token }}). The env: GITHUB_TOKEN block sets an environment variable that the action does not read for authentication. The script uses github.rest.pulls.requestReviewers() with the pre-authenticated client, making this environment variable a no-op and source of confusion.

Proposed fix
         await github.rest.pulls.requestReviewers({
           owner,
           repo,
           pull_number: prNumber,
           team_reviewers,
         });
-      env:
-        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


### Added

- GitHub Actions workflow to review pull requests labeled with `GFI` and `Beginner`. (`#1721`)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Changelog label name is inconsistent with the workflow's actual label, and section placement is off.

Two issues:

  1. The entry says `GFI` but the workflow checks for "Good First Issue" — these must match to avoid confusion about which label triggers the workflow.
  2. Other .github/ workflow additions are documented under the ### .github subsection (Lines 26–31), not under the top-level ### Added. For consistency, this entry should be moved there.
✏️ Proposed fix
 ### Added
 
-- GitHub Actions workflow to review pull requests labeled with `GFI` and `Beginner`. (`#1721`)
 - Added CodeRabbit review instructions ...
 ### .github
+- Added GitHub Actions workflow to request triage review for pull requests labeled with `Good First Issue` or `Beginner`. (`#1721`)
 - Added GitHub Actions workflow to remind draft PR authors ...

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Comment on lines +7 to +12
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run mode (no actual review requests will be made)'
required: false
default: 'true'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

dry_run input is declared but never consumed — mutations always execute.

The workflow_dispatch.inputs.dry_run input (with default: 'true') is defined, but the script block never calls core.getInput('dry_run'). Every manual dispatch runs pulls.requestReviewers unconditionally, defeating the safety-default intent of default: 'true'.

Per the coding guidelines: when dry_run=true, the workflow must log dry mode is active and must never post, comment, label, assign or edit.

🛡️ Proposed fix (in the extracted script file)
+const dryRun = core.getInput('dry_run') === 'true';
+core.info(`[triage-review] dry_run=${dryRun}, PR #${prNumber}, label="${context.payload.label?.name}"`);

 if (requestedUsers.includes(reviewer)) {
   console.log(`User ${reviewer} already requested for PR #${prNumber}`);
   return;
 }

+if (dryRun) {
+  core.info(`[DRY RUN] Would request reviewer '${reviewer}' on PR #${prNumber}. No action taken.`);
+  return;
+}
+
 await github.rest.pulls.requestReviewers({ ... });


jobs:
request-triage:
if: ${{ github.event.label && (github.event.label.name == 'Good First Issue' || github.event.label.name == 'Beginner') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

workflow_dispatch always skips the job, and context.payload.pull_request is null for dispatch — dry-run testing is completely broken.

Two compounding issues:

  1. Line 24 — if condition always false for workflow_dispatch: github.event.label is null on a manual dispatch. In GitHub Actions expressions this evaluates to '' (falsy), so the whole condition short-circuits and the job is permanently skipped.
  2. Line 31 — null dereference: Even after fixing the condition, context.payload.pull_request is null for workflow_dispatch, so .number throws a runtime error.

To make dry-run testing functional, the if condition must accommodate both triggers, and the script must accept a PR number input for manual dispatch:

🛡️ Proposed fix
   workflow_dispatch:
       inputs:
+        pr_number:
+          description: 'PR number to target (for dry-run testing)'
+          required: false
         dry_run:
           description: 'Dry run mode (no actual review requests will be made)'
           required: false
           default: 'true'
-    if: ${{ github.event.label && (github.event.label.name == 'Good First Issue' || github.event.label.name == 'Beginner') }}
+    if: ${{ github.event_name == 'workflow_dispatch' || (github.event.label && (github.event.label.name == 'Good First Issue' || github.event.label.name == 'Beginner')) }}
-            const prNumber = context.payload.pull_request.number;
+            const prNumber = context.payload.pull_request?.number
+              ?? parseInt(core.getInput('pr_number'), 10);
+            if (!prNumber) { core.setFailed('No PR number available.'); return; }

Also applies to: 31-31

Copy link
Contributor

@aceppaluni aceppaluni left a comment

Choose a reason for hiding this comment

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

@tech0priyanshu Thank you very much!

Was this tested on your fork?
Could we extract some of the logic into a sperate file (i.e .sh or .js)?

@aceppaluni aceppaluni added the status: needs developer revision PR has requested changes that the developer needs to implement label Feb 20, 2026
@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

Quick Fix for CHANGELOG.md Conflicts

If your conflict is only in CHANGELOG.md, you can resolve it easily using the GitHub web editor:

  1. Click on the "Resolve conflicts" button in the PR
  2. Accept both changes (keep both changelog entries)
  3. Click "Mark as resolved"
  4. Commit the merge

For all other merge conflicts, please read:

Thank you for contributing!

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1828   +/-   ##
=======================================
  Coverage   93.29%   93.29%           
=======================================
  Files         141      141           
  Lines        9118     9118           
=======================================
  Hits         8507     8507           
  Misses        611      611           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: tech0priyanshu <priyanshuyadv101106@gmail.com>
Signed-off-by: tech0priyanshu <priyanshuyadv101106@gmail.com>
Signed-off-by: tech0priyanshu <priyanshuyadv101106@gmail.com>
@tech0priyanshu tech0priyanshu force-pushed the feat/GFI_Beginner_triage branch from 0a34082 to 63cc81f Compare February 21, 2026 01:24
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5


OWNER=${GITHUB_REPOSITORY%%/*}
REPO=${GITHUB_REPOSITORY##*/}
REVIEWER="coderabbit"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Implementation completely misaligns with issue #1721 — reviewer assignment instead of comment, hardcoded bot instead of triage list.

The PR claims to implement issue #1721, but the implementation contradicts every stated objective:

Requirement (issue #1721) Implementation
Post a comment mentioning a triage member Requests coderabbit as a reviewer via pulls/requested_reviewers API
Select randomly from .github/triage-members.txt Hardcodes REVIEWER="coderabbit"
Do not assign reviewers Assigns a reviewer
Extract configurable values (label names, team file, template) All values inline/hardcoded
.github/triage-members.txt as the source of truth File does not exist in this PR

The entire approach needs to be rethought. The script should:

  1. Read .github/triage-members.txt and select a random member.
  2. Use the GitHub API to post a comment (POST /repos/{owner}/{repo}/issues/{issue_number}/comments) mentioning the selected member.
  3. Use a duplicate-comment marker (HTML comment) to prevent repeat posts on label toggles.

Comment on lines +38 to +46
echo "Requesting reviewer $REVIEWER for PR #$PR_NUMBER"
resp=$(curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
-d "{\"reviewers\":[\"$REVIEWER\"]}" \
"https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER/requested_reviewers")

if echo "$resp" | jq -e '.errors? // empty' >/dev/null 2>&1; then
echo "Request API returned an error: $resp"
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing --fail on curl — HTTP errors are silently swallowed and treated as success.

Both the GET (line 30) and POST (line 39) curl calls omit --fail/-f. A 401, 403, or 422 response produces an error body that is passed to jq and silently treated as a valid response. For the GET, an error body with no .users key means jq exits 3 (no output), the idempotency check is skipped, and the POST is attempted. For the POST, the .errors? // empty check on line 43 only catches GitHub API-level errors arrays — not top-level message-only failures (e.g. {"message":"Bad credentials"}).

🛡️ Proposed fix
-existing=$(curl -sS -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
-  "https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER/requested_reviewers")
+existing=$(curl -sS --fail -H "Authorization: Bearer $TOKEN" \
+  -H "Accept: application/vnd.github+json" \
+  -H "X-GitHub-Api-Version: 2022-11-28" \
+  "https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER/requested_reviewers")

...

-resp=$(curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
-  -d "{\"reviewers\":[\"$REVIEWER\"]}" \
-  "https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER/requested_reviewers")
+resp=$(curl -sS --fail -X POST -H "Authorization: Bearer $TOKEN" \
+  -H "Accept: application/vnd.github+json" \
+  -H "X-GitHub-Api-Version: 2022-11-28" \
+  -d "{\"reviewers\":[\"$REVIEWER\"]}" \
+  "https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER/requested_reviewers")

Signed-off-by: tech0priyanshu <priyanshuyadv101106@gmail.com>
Signed-off-by: tech0priyanshu <priyanshuyadv101106@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Comment on lines +38 to +48
TRIAGE_FILE=".github/triage-reviewers.txt"
if [ -f "$TRIAGE_FILE" ]; then
TRIAGE_LIST=$(tr '\n' ' ' < "$TRIAGE_FILE" | xargs)
else
TRIAGE_LIST="${TRIAGE_REVIEWERS:-}"
fi

if [ -z "$TRIAGE_LIST" ]; then
echo "No triage reviewers configured. Provide .github/triage-reviewers.txt or TRIAGE_REVIEWERS env var."
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

fd -t f "triage" .github/

Repository: hiero-ledger/hiero-sdk-python

Length of output: 160


🏁 Script executed:

cat -n .github/workflows/request-triage-review.yml

Repository: hiero-ledger/hiero-sdk-python

Length of output: 1325


🏁 Script executed:

cat -n .github/scripts/bot-pr-gfi-review-triage.sh | head -60

Repository: hiero-ledger/hiero-sdk-python

Length of output: 2543


🏁 Script executed:

rg "1721" .github/

Repository: hiero-ledger/hiero-sdk-python

Length of output: 186


🏁 Script executed:

rg "triage-members\|triage-reviewers" --no-heading

Repository: hiero-ledger/hiero-sdk-python

Length of output: 55


🏁 Script executed:

git log --oneline --all | grep -i "triage\|1721" | head -20

Repository: hiero-ledger/hiero-sdk-python

Length of output: 270


🏁 Script executed:

git diff --stat HEAD~5..HEAD

Repository: hiero-ledger/hiero-sdk-python

Length of output: 267


🏁 Script executed:

git diff HEAD~1 -- .github/scripts/bot-pr-gfi-review-triage.sh | head -100

Repository: hiero-ledger/hiero-sdk-python

Length of output: 101


🏁 Script executed:

git log --oneline -n 10

Repository: hiero-ledger/hiero-sdk-python

Length of output: 87


🏁 Script executed:

find .github -name "*.yml" -o -name "*.yaml" | xargs grep -l "TRIAGE_REVIEWERS" 2>/dev/null || echo "No TRIAGE_REVIEWERS found in workflow files"

Repository: hiero-ledger/hiero-sdk-python

Length of output: 116


🏁 Script executed:

ls -la .github/ | grep -E "\.txt|\.env|config"

Repository: hiero-ledger/hiero-sdk-python

Length of output: 135


.github/triage-reviewers.txt is not provided and TRIAGE_REVIEWERS env var is not set in the workflow.

The script expects either .github/triage-reviewers.txt to exist or TRIAGE_REVIEWERS to be passed as an environment variable. Neither is present: the file does not exist in the repository, and the workflow file does not set the env var. The script will fail on line 47 with exit 1 every time the workflow runs, making the triage review feature non-functional in any deployment of this PR.

Comment on lines +50 to +51
# Prepare mentions: accept comma or space separated values
mentions=$(echo "$TRIAGE_LIST" | sed -E 's/,/ /g')
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Usernames without @ prefix won't trigger GitHub notifications.

If .github/triage-reviewers.txt contains bare usernames (e.g., alice), the comment body will read Requesting triage review from: alice and no notification is sent. The expected format should be documented, or the script should normalise entries by prepending @ if absent (the proposed fix in the random-selection comment already handles this with @${REVIEWER#@}).

Comment on lines +50 to +54
# Prepare mentions: accept comma or space separated values
mentions=$(echo "$TRIAGE_LIST" | sed -E 's/,/ /g')

MARKER='<!-- triage-request -->'
BODY_TEXT="${MARKER}\nRequesting triage review from: $mentions"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Mentions all triage members instead of a randomly selected one — contradicts issue #1721.

Issue #1721 explicitly requires selecting a single random member from the list. Mentioning everyone on every GFI/Beginner PR will generate notification spam for the triage team.

♻️ Proposed fix
-# Prepare mentions: accept comma or space separated values
-mentions=$(echo "$TRIAGE_LIST" | sed -E 's/,/ /g')
+# Parse list into array and select one member at random
+IFS=$', \t\n' read -r -a TRIAGE_ARRAY <<< "$TRIAGE_LIST"
+TRIAGE_ARRAY=("${TRIAGE_ARRAY[@]}")   # compact empty entries
+REVIEWER="${TRIAGE_ARRAY[RANDOM % ${`#TRIAGE_ARRAY`[@]}]}"
+mentions="@${REVIEWER#@}"  # ensure exactly one @ prefix
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Prepare mentions: accept comma or space separated values
mentions=$(echo "$TRIAGE_LIST" | sed -E 's/,/ /g')
MARKER='<!-- triage-request -->'
BODY_TEXT="${MARKER}\nRequesting triage review from: $mentions"
# Parse list into array and select one member at random
IFS=$', \t\n' read -r -a TRIAGE_ARRAY <<< "$TRIAGE_LIST"
TRIAGE_ARRAY=("${TRIAGE_ARRAY[@]}") # compact empty entries
REVIEWER="${TRIAGE_ARRAY[RANDOM % ${`#TRIAGE_ARRAY`[@]}]}"
mentions="@${REVIEWER#@}" # ensure exactly one @ prefix
MARKER='<!-- triage-request -->'
BODY_TEXT="${MARKER}\nRequesting triage review from: $mentions"

Comment on lines +53 to +54
MARKER='<!-- triage-request -->'
BODY_TEXT="${MARKER}\nRequesting triage review from: $mentions"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

\n in double-quoted string is a literal backslash-n — the posted comment won't contain a newline.

In bash, "\n" inside "..." is not interpreted; the string passed to jq --arg contains a literal \ + n. jq then escapes the backslash, so the GitHub API receives \n as text in the comment body. The dry-run preview (using echo -e) does expand \n, creating a misleading discrepancy between what the preview shows and what actually gets posted.

🐛 Proposed fix
-BODY_TEXT="${MARKER}\nRequesting triage review from: $mentions"
+BODY_TEXT="${MARKER}"$'\n'"Requesting triage review from: $mentions"

$'\n' is a bash ANSI-C escape that inserts a real newline character, which jq then correctly serialises as \n in JSON (the GitHub API renders this as a line break).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MARKER='<!-- triage-request -->'
BODY_TEXT="${MARKER}\nRequesting triage review from: $mentions"
MARKER='<!-- triage-request -->'
BODY_TEXT="${MARKER}"$'\n'"Requesting triage review from: $mentions"

Comment on lines +59 to +60
comments=$(curl -fS -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$OWNER/$REPO/issues/$PR_NUMBER/comments")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Comment fetch is unpaginated — idempotency check fails if PR has >30 comments.

GitHub's default page size is 30 comments. On a busy GFI PR the existing triage marker could be on a later page and the duplicate-detection grep would miss it, causing a second triage comment to be posted.

🛡️ Proposed fix
-comments=$(curl -fS -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
-  "https://api.github.com/repos/$OWNER/$REPO/issues/$PR_NUMBER/comments")
+comments=$(curl -fS -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
+  "https://api.github.com/repos/$OWNER/$REPO/issues/$PR_NUMBER/comments?per_page=100")

As per coding guidelines: "Pagination MUST: Be considered and justified, Enforce hard upper bounds."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
comments=$(curl -fS -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$OWNER/$REPO/issues/$PR_NUMBER/comments")
comments=$(curl -fS -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$OWNER/$REPO/issues/$PR_NUMBER/comments?per_page=100")

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# 1. Check all actions/checkout references in workflows
echo "=== All actions/checkout references in workflows ==="
rg -n "actions/checkout" --type yaml .github/workflows/

# 2. Verify the specific SHA via GitHub API
echo ""
echo "=== Verifying SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 ==="
curl -sS "https://api.github.com/repos/actions/checkout/git/commits/34e114876b0b11c390a56381ad16ebd13914f8d5" 2>/dev/null | jq -r '{sha: .sha, message: .message, date: .committer.date}'

# 3. Get the release tag information for v4.3.1
echo ""
echo "=== Checking v4.3.1 release tag ==="
curl -sS "https://api.github.com/repos/actions/checkout/releases/tags/v4.3.1" 2>/dev/null | jq -r '{tag_name: .tag_name, target_commitish: .target_commitish}'

Repository: hiero-ledger/hiero-sdk-python

Length of output: 4910


Update actions/checkout to match repository standard: v6.0.1 with SHA 8e8c483db84b4bee98b60c0593521ed34d9990e8

The SHA pinning is valid, but v4.3.1 is outdated. Nearly all other workflows in this repository pin v6.0.1 (SHA 8e8c483db84b4bee98b60c0593521ed34d9990e8) or v6.0.2—only this workflow and bot-verified-commits.yml use the older v4 version. Update to the repository standard for consistency and to avoid drifting from the maintained major version.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

# Determine triage reviewers: prefer file in repo, fallback to TRIAGE_REVIEWERS env var
TRIAGE_FILE=".github/triage-reviewers.txt"
if [ -f "$TRIAGE_FILE" ]; then
TRIAGE_LIST=$(tr '\n' ' ' < "$TRIAGE_FILE" | xargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Comment lines (#-prefixed) in triage-reviewers.txt would be treated as usernames.

tr '\n' ' ' | xargs does no filtering; any # comment header lines in the file end up in TRIAGE_LIST and then in the posted comment body.

🛡️ Proposed fix
-  TRIAGE_LIST=$(tr '\n' ' ' < "$TRIAGE_FILE" | xargs)
+  TRIAGE_LIST=$(grep -v '^\s*#' "$TRIAGE_FILE" | tr '\n' ' ' | xargs)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
TRIAGE_LIST=$(tr '\n' ' ' < "$TRIAGE_FILE" | xargs)
TRIAGE_LIST=$(grep -v '^\s*#' "$TRIAGE_FILE" | tr '\n' ' ' | xargs)

@tech0priyanshu tech0priyanshu marked this pull request as draft February 21, 2026 02:33
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Hi @tech0priyanshu
As this workflow is not urgent, we should focus on creating clean code that is as easy as possible to maintain in the future

May i suggest you switch this from bash to javascript, using github script action
This will mean less manual constructions and is less error prone
Then please focus on writing this with clear exits and logs

Additionally it is essential to research each package you will be using, and use the latest version
docs/sdk_developers/how-to-pin-github-actions.md

We have some guides now in
docs/workflows

@github-actions
Copy link

Hello, this is the OfficeHourBot.

This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 hours (14:00 UTC).

This session provides an opportunity to ask questions regarding this Pull Request.

Details:

Disclaimer: This is an automated reminder. Please verify the schedule here for any changes.

From,
The Python SDK Team

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Hi @tech0priyanshu,

This pull request has had no commit activity for 10 days. Are you still working on it?
To keep the PR active, you can:

  • Push a new commit.
  • Comment /working on the linked issue (not this PR).

If you're no longer working on this, please comment /unassign on the linked issue to release it for others. Otherwise, this PR may be closed due to inactivity.

Reach out on discord or join our office hours if you need assistance.

From the Python SDK Team

name: Request triage review on beginner PRs

on:
pull_request_target:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe it can just be a simple cron job -
each hour or so, it identifies issues with labels 'good first issue', 'beginner' /etc
and then asks the triage team for a review.

I imagine this would be safer, avoiding pull request target, while still having issues write permissions

otherwise maybe on pull request label event, and i imagine there is no need to checkout any code or give any real permissions, but there could still be some concerns

overall, we can assess the feasibility before proceeding

@tech0priyanshu
Copy link
Contributor Author

Yeah, I will resume my work after this. I have exams from Monday to Friday, so I’m busy revising for them.

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

Labels

status: needs developer revision PR has requested changes that the developer needs to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Intermediate]: Create a workflow for PRs labelled 'Good First Issue' or 'Beginner' to request review from triage

4 participants