Skip to content

refactor: centralize broken-markdown-links and automated labels#2152

Merged
manishdait merged 1 commit into
hiero-ledger:mainfrom
Gitjay11:refactor-labels-2130
Apr 25, 2026
Merged

refactor: centralize broken-markdown-links and automated labels#2152
manishdait merged 1 commit into
hiero-ledger:mainfrom
Gitjay11:refactor-labels-2130

Conversation

@Gitjay11

@Gitjay11 Gitjay11 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Description:

Centralize the hardcoded workflow labels 'broken-markdown-links' and 'automated' into a shared .github/scripts/labels.js configuration module, and update the cron-pr-check-broken-links.yml workflow to import these constants via require(). This facilitates easier future label updates and maintenance.

Related issue

Fixes #2130

Notes for reviewer

Per maintainer feedback, the scope was narrowed to only centralize the label constants. The existing inline script structure in the workflow is preserved, only the hardcoded label strings were replaced with imports from labels.js.

@Gitjay11
Gitjay11 requested review from a team as code owners April 16, 2026 07:24
@codacy-production

codacy-production Bot commented Apr 16, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

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 new labels constants module and updates one workflow and one automation script to import and use those label constants; also adds workflow-level concurrency and tightens payload access in the workflow script.

Changes

Cohort / File(s) Summary
Label Constants
\.github/scripts/labels.js
New module exporting two label name constants: LABEL_BROKEN_MARKDOWN_LINKS: 'notes: broken markdown links' and LABEL_AUTOMATED: 'notes: automated'.
Workflow Configuration
\.github/workflows/cron-pr-check-broken-links.yml
Added workflow-level concurrency (group cron-check-broken-markdown-links, cancel-in-progress: false); GitHub Script step now requires ./.github/scripts/labels.js and uses imported label constants for targetLabels; dry-run detection uses optional chaining (context.payload?.inputs?.dry_run).
Automation Script Update
\.github/scripts/cron-admin-update-spam-list.js
Replaced hard-coded 'automated' label with imported LABEL_AUTOMATED constant when creating the spam-list-update issue (labels: [LABEL_SPAM_LIST_UPDATE, LABEL_AUTOMATED]).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #2130 but has incomplete implementation: labels.js correctly uses standardized label values, but cron-admin-update-spam-list.js still hardcodes the 'automated' label without importing from labels.js, failing to fully centralize all label occurrences as required. Update cron-admin-update-spam-list.js to import LABEL_AUTOMATED from labels.js and replace the hardcoded label string, ensuring complete centralization of all label references across the codebase.
Out of Scope Changes check ⚠️ Warning All changes align with the stated objective of centralizing label constants; however, the implementation is incomplete since not all hardcoded label references were replaced, leaving part of the scope unaddressed rather than introducing unrelated changes. Ensure all hardcoded label references ('automated' and 'broken-markdown-links') across all scripts are replaced with imports from the centralized labels.js module to complete the refactoring scope.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: centralizing hardcoded label strings into a shared configuration module.
Description check ✅ Passed The description clearly explains the centralization of label constants into labels.js and updates to the workflow to import these constants.
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.

📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #2130

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/cron-check-broken-links.yml (1)

40-44: 🧹 Nitpick | 🔵 Trivial

Add a concurrency guard before this step starts mutating issues.

.github/scripts/report-broken-links.js does a list-then-create check, so an overlapping manual dispatch, scheduled run, or retry can still create duplicate issues before either run sees the other's write. Put this workflow or job behind a fixed concurrency group.

Suggested workflow change
 name: Cron – Check Broken Markdown Links
+
+concurrency:
+  group: cron-check-broken-markdown-links
+  cancel-in-progress: false
 
 on:
   schedule:
As per coding guidelines, "Workflows that mutate state should use concurrency groups and duplicate prevention patterns (marker-based comments, check-before-create for labels)."

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 59bfdf3c-6e92-40d9-935d-ae7eda4eae67

📥 Commits

Reviewing files that changed from the base of the PR and between 245133d and caf25cb.

📒 Files selected for processing (4)
  • .github/scripts/labels.js
  • .github/scripts/report-broken-links.js
  • .github/scripts/update-spam-list.js
  • .github/workflows/cron-check-broken-links.yml

Comment thread .github/scripts/report-broken-links.js Outdated
Comment thread .github/scripts/update-spam-list.js
Comment thread .github/workflows/cron-check-broken-links.yml Outdated

@exploreriii exploreriii left a comment

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.

You have two PRs here, the spam and also the broken link one.

Could you please keep each pr a fresh copy from main

Only create the separate js file if you must, ideally there is minimal refactoring, and is as close to the original version as possible in this issue

@exploreriii
exploreriii marked this pull request as draft April 16, 2026 14:49
@Gitjay11
Gitjay11 force-pushed the refactor-labels-2130 branch 2 times, most recently from 29197b3 to d74bcb7 Compare April 16, 2026 23:30
@Gitjay11
Gitjay11 requested a review from exploreriii April 16, 2026 23:32
@Gitjay11

Copy link
Copy Markdown
Contributor Author

I have done the changes now, it is ready for review.

@Gitjay11
Gitjay11 marked this pull request as ready for review April 16, 2026 23:33

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 52be8f8b-e807-427d-a5a2-d1b23561a74b

📥 Commits

Reviewing files that changed from the base of the PR and between caf25cb and d74bcb7.

📒 Files selected for processing (2)
  • .github/scripts/labels.js
  • .github/workflows/cron-pr-check-broken-links.yml

Comment thread .github/workflows/cron-pr-check-broken-links.yml
@exploreriii exploreriii added the step: 1st 1st stage of the review approval process label Apr 17, 2026

@aceppaluni aceppaluni left a comment

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.

@Gitjay11 Did you test this on your fork?

@exploreriii exploreriii added reviewer: junior committer request review from junior committers with triage permissions reviewer: community pull requests looking for community reviews labels Apr 21, 2026
@AgrimTawani

Copy link
Copy Markdown
Contributor

Hey @Gitjay11, thanks for taking this on — you're headed in the right direction! A few things to sort out before this is ready:

  • Label values are wrong — you changed 'broken-markdown-links' to 'notes: broken markdown links' in labels.js.
    That's a silent breaking change. Match the exact values already in GitHub's label settings — you're just moving where
    they're defined, not what they are.

  • Centralization is incomplete'automated' is still hardcoded on line 232 of cron-admin-update-spam-list.js.
    That file needs to import labels.js too, otherwise the whole point of the issue isn't solved.

  • Add optional chaining — use context.payload?.inputs?.dry_run to avoid a crash on scheduled runs.
    This will also clear your two failing CodeRabbit checks.

  • Rebase onto a clean main@exploreriii flagged that changes from another PR are mixed in here.
    Clean that up before re-requesting review.

Please feel free to ask questions on any of the above tasks!

@github-actions

Copy link
Copy Markdown

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

@Gitjay11
Gitjay11 force-pushed the refactor-labels-2130 branch from d74bcb7 to 9598ccb Compare April 22, 2026 16:03
@Gitjay11

Copy link
Copy Markdown
Contributor Author

@Gitjay11 Did you test this on your fork?

@aceppaluni yes i have

@Gitjay11

Copy link
Copy Markdown
Contributor Author

Hey @Gitjay11, thanks for taking this on — you're headed in the right direction! A few things to sort out before this is ready:

  • Label values are wrong — you changed 'broken-markdown-links' to 'notes: broken markdown links' in labels.js.
    That's a silent breaking change. Match the exact values already in GitHub's label settings — you're just moving where
    they're defined, not what they are.
  • Centralization is incomplete'automated' is still hardcoded on line 232 of cron-admin-update-spam-list.js.
    That file needs to import labels.js too, otherwise the whole point of the issue isn't solved.
  • Add optional chaining — use context.payload?.inputs?.dry_run to avoid a crash on scheduled runs.
    This will also clear your two failing CodeRabbit checks.
  • Rebase onto a clean main@exploreriii flagged that changes from another PR are mixed in here.
    Clean that up before re-requesting review.

Please feel free to ask questions on any of the above tasks!

@AgrimTawani Thanks for this, I have done all the changes now. @exploreriii you can review it now.

@aceppaluni

Copy link
Copy Markdown
Contributor

@Gitjay11 Do you have a link to your test?

@Gitjay11

Copy link
Copy Markdown
Contributor Author

@Gitjay11 Do you have a link to your test?

For testing part, i created a new file to test it and it is running properly

image

@exploreriii exploreriii left a comment

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.

Hi thanks for your patience, we are trialing making some PRs open to community reviews.
This looks good to me once the names change back again, on to the second round

Comment thread .github/scripts/labels.js Outdated
@exploreriii
exploreriii marked this pull request as draft April 23, 2026 08:11
@exploreriii exploreriii removed step: 1st 1st stage of the review approval process reviewer: junior committer request review from junior committers with triage permissions labels Apr 23, 2026
@exploreriii exploreriii removed the reviewer: community pull requests looking for community reviews label Apr 23, 2026
Comment thread .github/scripts/labels.js
@aceppaluni

Copy link
Copy Markdown
Contributor

@Gitjay11 Happy to review again once changes are addressed.

@Gitjay11
Gitjay11 force-pushed the refactor-labels-2130 branch from 9598ccb to 4250060 Compare April 24, 2026 00:13
@Gitjay11
Gitjay11 marked this pull request as ready for review April 24, 2026 00:19
@Gitjay11

Copy link
Copy Markdown
Contributor Author

Hi @aceppaluni @exploreriii I did the changes, it is ready for review, Thanks.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/cron-admin-update-spam-list.js (1)

21-22: 🧹 Nitpick | 🔵 Trivial

Optional follow-up: centralize the remaining label constants too.

LABEL_SPAM and LABEL_SPAM_LIST_UPDATE are still defined inline here while LABEL_AUTOMATED now lives in labels.js. This is out of scope for this PR (maintainer narrowed scope to broken-markdown-links and automated), but moving them into .github/scripts/labels.js in a follow-up would finish the centralization started by issue #2130 and keep the single-source-of-truth invariant intact. Not a blocker.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a96bd4b3-2e72-46d8-95dd-14238d6d54c1

📥 Commits

Reviewing files that changed from the base of the PR and between 9598ccb and 4250060.

📒 Files selected for processing (3)
  • .github/scripts/cron-admin-update-spam-list.js
  • .github/scripts/labels.js
  • .github/workflows/cron-pr-check-broken-links.yml

Comment thread .github/scripts/labels.js
@exploreriii exploreriii added step: 2nd second stage of the review approval process reviewer: write requires a review with write permissions labels Apr 24, 2026
@manishdait

Copy link
Copy Markdown
Contributor

@Gitjay11, Please update the branch

@github-actions github-actions Bot added skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues notes: extra care requires extra attention to detail or requirements scope: CI/CD involves continuous integration or delivery labels Apr 24, 2026
@manishdait manishdait added step: merge ready PR is ready and waiting to merge status: update branch developer needs to click update branch and removed skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues notes: extra care requires extra attention to detail or requirements step: 2nd second stage of the review approval process reviewer: write requires a review with write permissions labels Apr 24, 2026
@Gitjay11
Gitjay11 force-pushed the refactor-labels-2130 branch from 4250060 to cb367db Compare April 25, 2026 07:08
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Gitjay11

Copy link
Copy Markdown
Contributor Author

@manishdait I updated the branch.

@coderabbitai coderabbitai Bot left a comment

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.

♻️ Duplicate comments (1)
.github/scripts/labels.js (1)

5-6: ⚠️ Potential issue | 🔴 Critical

Constant values do not match the labels currently defined in repo settings — breaking change for both consumers.

The earlier gh label list verification showed the repository's actual labels are broken-markdown-links and automated, not notes: broken markdown links / notes: automated. With these constants in place:

  • .github/workflows/cron-pr-check-broken-links.yml (line 56, line 82) will query listForRepo with labels that do not exist, so the idempotency check will never find an existing open issue and a new issue will be opened on every failing run.
  • .github/scripts/cron-admin-update-spam-list.js (line 233) will attempt to attach a non-existent notes: automated label to the created issue; the GitHub API will either reject the request or silently drop the unknown label depending on permissions, and downstream filters keyed on automated will stop matching.

This was also called out by maintainer review feedback on this PR: when centralizing, the constant values must match the labels currently defined in GitHub settings. If the rename to the notes: … form is intentional, that needs to land as a separate, coordinated change (create the new labels in repo settings, migrate existing tagged issues, then flip the constants).

Suggested minimal fix to unblock this PR:

🛠 Restore values to match existing repo labels
-const LABEL_BROKEN_MARKDOWN_LINKS = 'notes: broken markdown links';
-const LABEL_AUTOMATED = 'notes: automated';
+const LABEL_BROKEN_MARKDOWN_LINKS = 'broken-markdown-links';
+const LABEL_AUTOMATED = 'automated';

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 826f54e2-09c8-4361-9084-fbf7382155c0

📥 Commits

Reviewing files that changed from the base of the PR and between 4250060 and cb367db.

📒 Files selected for processing (3)
  • .github/scripts/cron-admin-update-spam-list.js
  • .github/scripts/labels.js
  • .github/workflows/cron-pr-check-broken-links.yml

@github-actions github-actions Bot added skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues notes: extra care requires extra attention to detail or requirements labels Apr 25, 2026
@manishdait
manishdait merged commit 53cc7ae into hiero-ledger:main Apr 25, 2026
11 checks passed
parvninama pushed a commit to parvninama/hiero-sdk-python that referenced this pull request Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes: extra care requires extra attention to detail or requirements scope: CI/CD involves continuous integration or delivery skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues status: update branch developer needs to click update branch step: merge ready PR is ready and waiting to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor automated and broken-markdown label

5 participants