Skip to content

Commit ebd0cea

Browse files
committed
Reword for clarity
1 parent b67ef0d commit ebd0cea

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

.github/workflows/check-signature.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
script: |
2525
// Enforce strictly typed parameter input to prevent code injection
2626
const prNumber = Number('${{ inputs.pr_number }}');
27-
if (isNaN(prNumber)) {
28-
core.setFailed("Invalid PR number input context.");
27+
if (!Number.isInteger(prNumber) || prNumber <= 0) {
28+
core.setFailed("Invalid PR number input context (expected a positive integer).");
2929
return;
3030
}
3131
@@ -67,12 +67,12 @@ jobs:
6767
6868
// Fail closed if PR exceeds max single-page limits (100 commits)
6969
if (commitsConnection.pageInfo.hasNextPage || commitsConnection.totalCount > 100) {
70-
core.setFailed(`PR block: Pull Request contains too many commits (${commitsConnection.totalCount}). Maximum supported limit for a automated verification run is 100 commits.`);
70+
core.setFailed(`PR block: Pull Request contains too many commits (${commitsConnection.totalCount}). Maximum supported limit for an automated verification run is 100 commits.`);
7171
return;
7272
}
7373
74-
// 2. Identify unsigned or validation-failing commits
75-
const unsignedCommits = commits.filter(c => !c.commit.signature || !c.commit.signature.isValid);
74+
// 2. Identify unverified commits (unsigned or signature validation failed)
75+
const unverifiedCommits = commits.filter(c => !c.commit.signature || !c.commit.signature.isValid);
7676
7777
// 3. Scan for an existing bot comment to update or delete
7878
const comments = await github.rest.issues.listComments({
@@ -85,12 +85,12 @@ jobs:
8585
const existingComment = comments.data.find(c => c.body.includes(commentIdentifier));
8686
8787
// 4. Handle logic based on validation state
88-
if (unsignedCommits.length > 0) {
89-
const commitList = unsignedCommits.map(c => `- \`${c.commit.oid.substring(0, 7)}\``).join('\n');
90-
const commentBody = `${commentIdentifier}\n ⚠️ **Unsigned Commits Detected**\n\nThe following commits in this Pull Request are missing a verified cryptographic signature:\n\n${commitList}\n\nPlease sign your commits to comply with <a href="https://metoffice.github.io/simulation-systems/WorkingPractices/gh_authorisation.html#verified-commits">project guidelines</a>.`;
88+
if (unverifiedCommits.length > 0) {
89+
const commitList = unverifiedCommits.map(c => `- \`${c.commit.oid.substring(0, 7)}\``).join('\n');
90+
const commentBody = `${commentIdentifier}\n ⚠️ **Unverified Commits Detected**\n\nThe following commits in this Pull Request are missing a verified cryptographic signature:\n\n${commitList}\n\nPlease sign your commits to comply with <a href="https://metoffice.github.io/simulation-systems/WorkingPractices/gh_authorisation.html#verified-commits">project guidelines</a>.`;
9191
9292
if (existingComment) {
93-
// Update the old comment with the refreshed list of unsigned commits
93+
// Update the old comment with the refreshed list of unverified commits
9494
await github.rest.issues.updateComment({
9595
owner: context.repo.owner,
9696
repo: context.repo.repo,

0 commit comments

Comments
 (0)