Skip to content

Commit 7c53b5d

Browse files
authored
Merge branch 'main' into chore/update-crypto-public-key
2 parents 66afa8d + b382836 commit 7c53b5d

45 files changed

Lines changed: 158 additions & 169 deletions

Some content is hidden

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

.github/scripts/bot-p0-issues-notify-team.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
// Script to notify the team when a P0 issue is created.
22

3+
const CRITICAL_LABEL = 'priority: critical';
34
const marker = '<!-- P0 Issue Notification -->';
45

5-
async function notifyTeam(github, owner, repo, issue, marker) {
6-
const comment = `${marker} :rotating_light: Attention Team :rotating_light:
6+
async function notifyTeam(github, owner, repo, issue, marker) {
7+
const safeTitle = String(issue.title || '(no title)')
8+
.replace(/[\r\n]+/g, ' ')
9+
.replace(/@/g, '@\u200b')
10+
.trim();
11+
12+
const comment = `${marker} :rotating_light: Attention Team :rotating_light:
713
@hiero-ledger/hiero-sdk-python-maintainers @hiero-ledger/hiero-sdk-python-committers @hiero-ledger/hiero-sdk-python-triage
814
9-
A new P0 issue has been created: #${issue.number} - ${issue.title || '(no title)'}
15+
A new critical priority issue has been created: #${issue.number} - ${safeTitle}
1016
Please prioritize this issue accordingly.
1117
1218
Best Regards,
1319
Automated Notification System`;
1420

15-
try {
16-
await github.rest.issues.createComment({
17-
owner,
18-
repo,
19-
issue_number: issue.number,
20-
body: comment,
21-
});
22-
console.log(`Notified team about P0 issue #${issue.number}`);
23-
return true;
24-
} catch (commentErr) {
25-
console.log(`Failed to notify team about P0 issue #${issue.number}:`, commentErr.message || commentErr);
26-
return false;
27-
}
21+
try {
22+
await github.rest.issues.createComment({
23+
owner,
24+
repo,
25+
issue_number: issue.number,
26+
body: comment,
27+
});
28+
console.log(`Notified team about ${CRITICAL_LABEL} issue #${issue.number}`);
29+
return true;
30+
} catch (commentErr) {
31+
console.log(`Failed to notify team about ${CRITICAL_LABEL} issue #${issue.number}:`, commentErr.message || commentErr);
32+
return false;
2833
}
34+
}
2935

3036
module.exports = async ({ github, context }) => {
3137
try {
@@ -34,8 +40,8 @@ module.exports = async ({ github, context }) => {
3440

3541
// Validations
3642
if (!issue?.number) return console.log('No issue in payload');
37-
if (label?.name?.toLowerCase() !== 'p0') return;
38-
if (!issue.labels?.some(l => l?.name?.toLowerCase() === 'p0')) return;
43+
if (label?.name?.toLowerCase() !== CRITICAL_LABEL.toLowerCase()) return;
44+
if (!issue.labels?.some((l) => l?.name?.toLowerCase() === CRITICAL_LABEL.toLowerCase())) return;
3945

4046
// Check for existing comment
4147
const comments = await github.paginate(github.rest.issues.listComments, {
@@ -44,7 +50,7 @@ module.exports = async ({ github, context }) => {
4450
if (comments.some(c => c.body?.includes(marker))) {
4551
return console.log(`Notification already exists for #${issue.number}`);
4652
}
47-
// Post notification
53+
// Post notification
4854
await notifyTeam(github, owner, repo, issue, marker);
4955

5056
console.log('=== Summary ===');

.github/scripts/cron-admin-update-spam-list.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ const fs = require('fs').promises;
1212
const SPAM_LIST_PATH = '.github/spam-list.txt';
1313
const dryRun = (process.env.DRY_RUN || 'false').toString().toLowerCase() === 'true';
1414

15+
/**
16+
* These constants control the GitHub label names used by the spam automation.
17+
* To rename labels, update only the constant values here.
18+
* Ensure corresponding labels exist in the GitHub repository settings.
19+
*/
20+
const LABEL_SPAM = 'notes: spam';
21+
const LABEL_SPAM_LIST_UPDATE = 'notes: spam-list-update';
22+
1523
// Load current spam list and compute updates based on spam vs rehabilitated users
1624

1725
async function computeSpamListUpdates(spamUsers, rehabilitatedUsers) {
@@ -121,7 +129,7 @@ module.exports = async ({github, context, core}) => {
121129
const searches = [
122130
{
123131
name: 'spam PRs',
124-
query: `repo:${owner}/${repo} is:pr is:closed -is:merged label:spam`,
132+
query: `repo:${owner}/${repo} is:pr is:closed -is:merged label:"${LABEL_SPAM}"`,
125133
process: async (pr) => {
126134
if (!pr.user?.login) {
127135
console.log(`Skipping PR #${pr.number}: user account unavailable`);
@@ -208,7 +216,7 @@ module.exports = async ({github, context, core}) => {
208216
const { data: existing } = await github.rest.issues.listForRepo({
209217
owner,
210218
repo,
211-
labels: 'spam-list-update',
219+
labels: LABEL_SPAM_LIST_UPDATE,
212220
state: 'open',
213221
per_page: 1
214222
});
@@ -221,7 +229,7 @@ module.exports = async ({github, context, core}) => {
221229
repo,
222230
title,
223231
body,
224-
labels: ['spam-list-update', 'automated']
232+
labels: [LABEL_SPAM_LIST_UPDATE, 'automated']
225233
});
226234
console.log('Issue created successfully');
227235
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env node
2+
3+
const { execSync } = require("child_process");
4+
const fs = require("fs");
5+
6+
// These are the directories we want to check for correct naming
7+
const TEST_DIRS = ["tests/unit", "tests/integration", "tests/tck", "tests/fuzz"];
8+
9+
// These are the excluded paths and file names inside the TEST_DIRS
10+
const IGNORED = ["tests/fuzz/support"];
11+
const EXCEPTIONS = ["conftest.py", "__init__.py", "init.py", "mock_server.py", "utils.py"];
12+
13+
// Collect naming errors to report at the end
14+
const nameErrors = [];
15+
16+
// Use "git ls-files" to get all tracked files in the repository
17+
const output = execSync("git ls-files", { encoding: "utf-8" });
18+
// Split output into lines and filter out empty lines for easy manipulation
19+
// e.g. output = "tests/unit/my_test.py\ntests/integration/other_test.py"
20+
const files = output.split("\n").filter(Boolean);
21+
22+
for (const file of files) {
23+
// --- PATH FILTERING ---
24+
// Skip files that are not in any of the specified test directories
25+
if (!TEST_DIRS.some(dir => file.startsWith(dir))) continue;
26+
27+
// Skip ignored paths (e.g. helpers)
28+
if (IGNORED.some(path => file.startsWith(path))) continue;
29+
30+
// Now we have file paths that we need to check for correct naming
31+
// e.g. file = "tests/unit/my_test.py"
32+
33+
// --- Correct PATH now apply NAMING checks ---
34+
35+
// Extract the file name from the path
36+
// e.g. from file = "tests/unit/my_test.py" get name = "my_test.py"
37+
const name = file.split("/").pop();
38+
39+
// Skip allowed special files
40+
if (EXCEPTIONS.includes(name)) continue;
41+
42+
// Enforce naming rule on files
43+
if (!name.endsWith("_test.py")) {
44+
console.error(`Invalid test file name: ${file}`);
45+
console.error(`::error file=${file}::Must end with '_test.py'`);
46+
nameErrors.push(file);
47+
}
48+
}
49+
50+
// Generate a summary of the results for the GitHub Actions UI
51+
const summaryPath = process.env.GITHUB_STEP_SUMMARY;
52+
53+
if (summaryPath) {
54+
let summary = `## 🧪 Test File Naming Check\n\n`;
55+
56+
if (nameErrors.length === 0) {
57+
summary += `✅ All test files are correctly named\n`;
58+
} else {
59+
// Counts and lists all the incorrectly named test files
60+
summary += `❌ Found ${nameErrors.length} incorrectly named test files:\n\n`;
61+
nameErrors.forEach(f => {
62+
summary += `- \`${f}\`\n`;
63+
});
64+
}
65+
66+
fs.appendFileSync(summaryPath, summary);
67+
}
68+
69+
// Fail job if needed
70+
if (nameErrors.length > 0) {
71+
process.exit(1);
72+
}

.github/scripts/pr-check-test-files.sh

Lines changed: 0 additions & 93 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: hl-sdk-py-lin-md
2929
steps:
3030
- name: Harden the runner (Audit all outbound calls)
31-
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
31+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
3232
with:
3333
egress-policy: audit
3434

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: hl-sdk-py-lin-md
1313
steps:
1414
- name: Harden the runner
15-
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
15+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
1616
with:
1717
egress-policy: audit
1818

.github/workflows/bot-beginner-assign-on-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: Harden runner
26-
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
26+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2727
with:
2828
egress-policy: audit
2929

.github/workflows/bot-coderabbit-plan-trigger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
3636
steps:
3737
- name: Harden the runner
38-
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
38+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
3939
with:
4040
egress-policy: audit
4141

.github/workflows/bot-gfi-assign-on-comment.yml

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

2525
steps:
2626
- name: Harden runner
27-
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
27+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2828
with:
2929
egress-policy: audit
3030

.github/workflows/bot-gfi-candidate-notification.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Harden the runner
24-
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df
24+
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40
2525
with:
2626
egress-policy: audit
2727

0 commit comments

Comments
 (0)