You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Process batch and keep only unverified commits in memory
77
+
for (const node of connection.nodes) {
78
+
if (!node.commit.signature || !node.commit.signature.isValid) {
79
+
unverifiedCommits.push({ oid: node.commit.oid });
80
+
}
81
+
}
76
82
77
-
// Fail closed if PR exceeds max single-page limits (100 commits)
78
-
if (commitsConnection.pageInfo.hasNextPage || commitsConnection.totalCount > 100) {
79
-
core.setFailed(`PR block: Pull Request contains too many commits (${commitsConnection.totalCount}). Maximum supported limit for an automated verification run is 100 commits.`);
80
-
return;
83
+
hasNextPage = connection.pageInfo.hasNextPage;
84
+
cursor = connection.pageInfo.endCursor;
81
85
}
82
86
83
-
// 2. Identify unverified commits (unsigned or signature validation failed)
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>.`;
100
102
101
103
if (existingComment) {
102
-
// Update the old comment with the refreshed list of unverified commits
103
104
await github.rest.issues.updateComment({
104
-
owner: context.repo.owner,
105
-
repo: context.repo.repo,
105
+
owner,
106
+
repo,
106
107
comment_id: existingComment.id,
107
108
body: commentBody
108
109
});
109
110
} else {
110
-
// Post a new warning comment
111
111
await github.rest.issues.createComment({
112
-
owner: context.repo.owner,
113
-
repo: context.repo.repo,
112
+
owner,
113
+
repo,
114
114
issue_number: prNumber,
115
115
body: commentBody
116
116
});
117
117
}
118
118
119
-
// Force the CI status check to fail outright
120
119
core.setFailed("PR block: One or more commits do not have a verified signature.");
121
120
return;
122
121
123
122
} else {
124
-
// All commits are signed! Clear old warning comment if it exists
125
123
if (existingComment) {
126
124
await github.rest.issues.deleteComment({
127
-
owner: context.repo.owner,
128
-
repo: context.repo.repo,
125
+
owner,
126
+
repo,
129
127
comment_id: existingComment.id
130
128
});
131
129
console.log("::notice::Clean state achieved: Deleted the old signature warning comment.");
0 commit comments