Skip to content

Commit b5a78ff

Browse files
authored
Merge branch 'hiero-ledger:main' into main
2 parents a9ce5a7 + ea81547 commit b5a78ff

File tree

64 files changed

+304
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+304
-106
lines changed
File renamed without changes.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Script to notify the team when a Good First Issue Candidate is created.
2+
3+
const marker = '<!-- GFI Candidate Notification -->';
4+
const TEAM_ALIAS = '@hiero-ledger/hiero-sdk-good-first-issue-support';
5+
6+
7+
async function notifyTeam(github, owner, repo, issue, message) {
8+
const dryRun = process.env.DRY_RUN === 'true';
9+
if (dryRun) {
10+
console.log('Notified team about GFI candidate');
11+
console.log(`Repo: ${owner}/${repo}`);
12+
console.log(`Issue: #${issue.number} - ${issue.title}`);
13+
console.log(`Message:\n${message}`);
14+
return true;
15+
}
16+
const comment = `${marker} :wave: Hello Team :wave:
17+
${TEAM_ALIAS}
18+
19+
${message}
20+
21+
Repository: ${owner}/${repo}
22+
Issue: #${issue.number} - ${issue.title || '(no title)'}
23+
24+
Best Regards,
25+
Hiero Python SDK team`;
26+
27+
try {
28+
await github.rest.issues.createComment({
29+
owner,
30+
repo,
31+
issue_number: issue.number,
32+
body: comment,
33+
});
34+
console.log(`Notified team about #${issue.number}`);
35+
return true;
36+
} catch (err) {
37+
console.log(
38+
`Failed to notify team about GFI candidate #${issue.number}:`,
39+
err.message || err
40+
);
41+
return false;
42+
}
43+
}
44+
45+
module.exports = async ({ github, context }) => {
46+
try {
47+
const { owner, repo } = context.repo;
48+
const { issue, label } = context.payload;
49+
const dryRun = process.env.DRY_RUN === 'true';
50+
51+
if (!issue?.number || !label?.name) {
52+
return console.log('Missing issue or label in payload');
53+
}
54+
55+
// Only handle Good First Issue Candidate
56+
if (label.name.toLowerCase() !== 'good first issue candidate') {
57+
return;
58+
}
59+
60+
// Checking dry run
61+
dryRun && console.log('DRY-RUN active');
62+
63+
// Prevent duplicate notifications
64+
const comments = await github.paginate(
65+
github.rest.issues.listComments,
66+
{ owner, repo, issue_number: issue.number, per_page: 100 }
67+
);
68+
69+
if (comments.some(c => c.body?.includes(marker))) {
70+
return console.log(`Notification already exists for #${issue.number}`);
71+
}
72+
73+
const message =
74+
'A new Good First Issue Candidate has been created. Please review it and confirm whether it should be labeled as a Good First Issue.';
75+
76+
const success = await notifyTeam(github, owner, repo, issue, message);
77+
78+
if (success) {
79+
console.log('=== Summary ===');
80+
console.log(`Repository: ${owner}/${repo}`);
81+
console.log(`Issue Number: ${issue.number}`);
82+
console.log(`Label: ${label.name}`);
83+
}
84+
} catch (err) {
85+
console.log('❌ Error:', err.message);
86+
throw err;
87+
}
88+
};

.github/scripts/bot-issue-reminder-no-pr.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set -euo pipefail
1010
REPO="${REPO:-${GITHUB_REPOSITORY:-}}"
1111
DAYS="${DAYS:-7}"
1212
DRY_RUN="${DRY_RUN:-false}"
13+
MARKER='<!-- issue-reminder-bot -->'
1314

1415
# Normalize DRY_RUN to "true" or "false"
1516
if [[ "$DRY_RUN" == "true" || "$DRY_RUN" == "yes" || "$DRY_RUN" == "1" ]]; then
@@ -72,7 +73,7 @@ echo "$ALL_ISSUES_JSON" | jq -c '.' | while read -r ISSUE_JSON; do
7273

7374
# Check if this issue already has a reminder comment from ReminderBot
7475
EXISTING_COMMENT=$(gh api "repos/$REPO/issues/$ISSUE/comments" \
75-
--jq ".[] | select(.user.login == \"github-actions[bot]\") | select(.body | contains(\"ReminderBot\")) | .id" \
76+
--jq ".[] | select(.user.login == \"github-actions[bot]\") | select(.body | contains(\"<!-- issue-reminder-bot -->\")) | .id" \
7677
| head -n1)
7778

7879
if [ -n "$EXISTING_COMMENT" ]; then
@@ -136,10 +137,12 @@ echo "$ALL_ISSUES_JSON" | jq -c '.' | while read -r ISSUE_JSON; do
136137

137138
ASSIGNEE_MENTIONS=$(echo "$ISSUE_JSON" | jq -r '.assignees[].login | "@" + .' | xargs)
138139

139-
MESSAGE="Hi ${ASSIGNEE_MENTIONS} 👋
140+
MESSAGE="${MARKER}
141+
Hi ${ASSIGNEE_MENTIONS} 👋
140142
141143
This issue has been assigned but no pull request has been created yet.
142144
Are you still planning on working on it?
145+
If you are, please create a draft PR linked to this issue so we know you are working on it.
143146
144147
From the Python SDK Team"
145148

@@ -155,4 +158,4 @@ done
155158

156159
echo "------------------------------------------------------------"
157160
echo " Issue Reminder Bot (No PR) complete."
158-
echo "------------------------------------------------------------"
161+
echo "------------------------------------------------------------"

.github/scripts/bot-pr-missing-linked-issue.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ module.exports = async ({ github, context }) => {
2020
prData = prResponse.data;
2121
}
2222

23+
const authorType = prData.user?.type;
24+
const authorLogin = prData.user?.login;
25+
26+
if (authorType === "Bot" || authorLogin?.endsWith('[bot]')){
27+
console.log(`Skipping comment: PR created by bot (${authorLogin})`);
28+
return;
29+
}
30+
2331
const body = prData.body || "";
2432
const regex = /\bFixes\s*:?\s*(#\d+)(\s*,\s*#\d+)*/i;
2533

@@ -81,5 +89,4 @@ module.exports = async ({ github, context }) => {
8189
console.error('Repository:', `${context.repo.owner}/${context.repo.repo}`);
8290
throw error;
8391
}
84-
};
85-
92+
};

.github/workflows/bot-advanced-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ jobs:
3434
ISSUE_NUMBER: ${{ github.event.issue.number }}
3535
REPO: ${{ github.repository }}
3636
run: |
37-
chmod +x .github/scripts/check_advanced_requirement.sh
38-
./.github/scripts/check_advanced_requirement.sh
37+
chmod +x .github/scripts/bot-advanced-check.sh
38+
./.github/scripts/bot-advanced-check.sh
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow notifies the GFI support team when an issue is labeled as GFI Candidate.
2+
3+
name: Good First Issue Candidate Notification
4+
5+
on:
6+
issues:
7+
types:
8+
- labeled
9+
10+
permissions:
11+
issues: write
12+
contents: read
13+
14+
jobs:
15+
gfi_candidate_notify_team:
16+
runs-on: ubuntu-latest
17+
if: contains(github.event.issue.labels.*.name, 'good first issue candidate')
18+
concurrency:
19+
group: gfi-candidate-${{ github.event.issue.number }}
20+
cancel-in-progress: false
21+
22+
steps:
23+
- name: Harden the runner
24+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76
25+
with:
26+
egress-policy: audit
27+
28+
- name: Checkout repository
29+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
30+
31+
- name: Notify team of GFI candidate
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
DRY_RUN: ${{ github.repository_owner != 'hiero-ledger' }}
35+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd #v8.0.0
36+
with:
37+
script: |
38+
const script = require('./.github/scripts/bot-gfi-candidate-notification.js');
39+
await script({ github, context });

.github/workflows/pr-check-codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
python-version: "3.11"
2525

2626
- name: Install uv
27-
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
27+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
2828

2929
- name: Install dependencies
3030
run: |

.github/workflows/pr-check-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fetch-depth: 0
2525

2626
- name: Install uv
27-
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867
27+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b
2828

2929
- name: Install dependencies
3030
run: uv sync

.github/workflows/pr-check-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cache: "pip"
3737

3838
- name: Install uv
39-
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
39+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
4040

4141
- name: Install setuptools wheel
4242
run: pip install --upgrade pip setuptools wheel

CHANGELOG.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
77
## [Unreleased]
88

99
### Added
10+
- Added comprehensive docstring to `FeeAssessmentMethod` enum explaining inclusive vs exclusive fee assessment methods with usage examples. (#1391)
11+
- Added comprehensive docstring to `TokenType` enum explaining fungible vs non-fungible tokens with practical use cases. (#1392)
12+
13+
- Added a notification workflow that alerts the support team when an issue is labeled as a Good First Issue Candidate.[(#1296)]
1014
- Added comprehensive training documentation for the `Query` class, covering execution flow, payments, retries, and building child queries. (#1238)
1115
- Beginner issue documentation and updated GFI and GFIC templates and documentation
1216
- Enable auto assignment to good first issues (#1312), archived good first issue support team notification. Changed templates with new assign instruction.
1317
- Intermediate issue documentation
1418
- Added unit test for 'endpoint.py' to increase coverage.
1519
- Automated assignment guard for `advanced` issues; requires completion of at least one `good first issue` and one `intermediate` issue before assignment (exempts maintainers, committers, and triage members). (#1142)
1620
- Added Hbar object support for TransferTransaction HBAR transfers:
17-
- Methods now accept `Union[int, Hbar]` for amount parameters with immediate normalization to tinybars
18-
- Includes comprehensive unit tests covering various Hbar units (HBAR, MICROBAR, NANOBAR, TINYBAR) and accumulation behavior with mixed `int` and `Hbar` inputs
19-
- Added a module-level docstring to the HBAR allowance approval example to clarify
20-
delegated spending behavior and key concepts. [#1202](https://github.com/hiero-ledger/hiero-sdk-python/issues/1202)
21+
- Methods now accept `Union[int, Hbar]` for amount parameters with immediate normalization to tinybars
22+
- Includes comprehensive unit tests covering various Hbar units (HBAR, MICROBAR, NANOBAR, TINYBAR) and accumulation behavior with mixed `int` and `Hbar` inputs
23+
- Added a module-level docstring to the HBAR allowance approval example to clarify delegated spending behavior and key concepts. [#1202](https://github.com/hiero-ledger/hiero-sdk-python/issues/1202)
2124
- Added a GitHub Actions workflow to validate broken Markdown links in pull requests.
2225
- Added method chaining examples to the developer training guide (`docs/sdk_developers/training/coding_token_transactions.md`) (#1194)
2326
- Added documentation explaining how to pin GitHub Actions to specific commit SHAs (`docs/sdk_developers/how-to-pin-github-actions.md`)(#1211)
@@ -92,6 +95,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
9295
- Added technical docstrings and hardening (set -euo pipefail) to the pr-check-test-files.sh script (#1336)
9396

9497
### Changed
98+
- Renamed `.github/scripts/check_advanced_requirement.sh` to `bot-advanced-check.sh` for workflow consistency (#1341)
9599
- Added global review instructions to CodeRabbit configuration to limit reviews to issue/PR scope and prevent scope creep [#1373]
96100
- Archived unused auto draft GitHub workflow to prevent it from running (#1371)
97101
- Added comprehensive documentation to the PR changelog check script (`.github/scripts/pr-check-changelog.sh`) to clarify behavior, inputs, permissions, and dependencies [(#1337)]
@@ -148,6 +152,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
148152
- Enhance assignment bot to guard against users with spam PRs `.github/scripts/bot-assignment-check.sh`
149153
- Add CodeRabbit documentation review prompts for docs, sdk_users, and sdk_developers with priorities, philosophy, and edge case checks. ([#1236](https://github.com/hiero-ledger/hiero-sdk-python/issues/1236))
150154
- Enhance NodeAddress tests with additional coverage for proto conversion `tests/unit/node_address_test.py`
155+
- Replaced deprecated `AccountCreateTransaction.set_key()` usage with `set_key_without_alias()` and `set_key_with_alias()` across examples and tests
156+
151157
- Updated `pyproject.toml` to enforce stricter Ruff linting rules, including Google-style docstrings (`D`), import sorting (`I`), and modern Python syntax (`UP`).
152158
- Modified and renamed hasIntermediateOrAdvancedLabel() to check if issue label is beginner or higher (#1385)
153159

@@ -167,6 +173,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
167173
- Fixed `cron-check-broken-links.yml` string parsing issue in context input `dry_run` (#1235)
168174
- Flaky tests by disabling TLS in mock Hedera nodes in `mock_server.py`
169175
- Fixed LinkBot permission issue for fork PRs by changing trigger to pull_request_target and adding proper permissions.
176+
- Fixed duplicate comment prevention in issue reminder bot by adding hidden HTML marker for reliable comment detection (.github/scripts/bot-issue-reminder-no-pr.sh) (#1372)
177+
- Fixed bot-pr-missing-linked-issue to skip commenting on pull requests created by automated bots. (#1382)
170178

171179
### Breaking Change
172180

0 commit comments

Comments
 (0)