Re-enable API proposal version check (#300716)

* Revert "Merge pull request #300495 from mjbvz/dev/mjbvz/fierce-hawk"

This reverts commit 2eefd9e554, reversing
changes made to 34bfd71aea.

* Add lots of logging

* Update .github/workflows/api-proposal-version-check.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Alex Ross
2026-03-11 13:37:38 +01:00
committed by GitHub
parent f9b7df95eb
commit 3e89f06714

View File

@@ -23,11 +23,14 @@ jobs:
check-version-changes:
name: Check API Proposal Version Changes
# Run on PR events, or on issue_comment if it's on a PR and contains the override command
if: false # temporarily disabled
# github.event_name == 'pull_request' ||
# (github.event_name == 'issue_comment' &&
# github.event.issue.pull_request &&
# contains(github.event.comment.body, '/api-proposal-change-required'))
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '/api-proposal-change-required') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'))
runs-on: ubuntu-latest
steps:
- name: Get PR info
@@ -71,25 +74,50 @@ jobs:
// Only accept overrides from trusted users (repo members/collaborators)
const trustedAssociations = ['OWNER', 'MEMBER', 'COLLABORATOR'];
const overrideComment = comments.find(comment =>
comment.body.includes('/api-proposal-change-required') &&
trustedAssociations.includes(comment.author_association)
);
let overrideComment = null;
const untrustedOverrides = [];
comments.forEach((comment, index) => {
const hasOverrideText = comment.body.includes('/api-proposal-change-required');
const isTrusted = trustedAssociations.includes(comment.author_association);
console.log(`Comment ${index + 1}:`);
console.log(` Author: ${comment.user.login}`);
console.log(` Author association: ${comment.author_association}`);
console.log(` Created at: ${comment.created_at}`);
console.log(` Contains override command: ${hasOverrideText}`);
console.log(` Author is trusted: ${isTrusted}`);
console.log(` Would be valid override: ${hasOverrideText && isTrusted}`);
if (hasOverrideText) {
if (isTrusted && !overrideComment) {
overrideComment = comment;
} else if (!isTrusted) {
untrustedOverrides.push(comment);
}
}
});
if (overrideComment) {
console.log(`Override comment found by ${overrideComment.user.login} (${overrideComment.author_association})`);
console.log(`Override comment FOUND`);
console.log(` Comment ID: ${overrideComment.id}`);
console.log(` Author: ${overrideComment.user.login}`);
console.log(` Association: ${overrideComment.author_association}`);
console.log(` Created at: ${overrideComment.created_at}`);
core.setOutput('override_found', 'true');
core.setOutput('override_user', overrideComment.user.login);
} else {
// Check if there's an override from an untrusted user
const untrustedOverride = comments.find(comment =>
comment.body.includes('/api-proposal-change-required') &&
!trustedAssociations.includes(comment.author_association)
);
if (untrustedOverride) {
console.log(`Override comment by ${untrustedOverride.user.login} ignored (${untrustedOverride.author_association} is not trusted)`);
if (untrustedOverrides.length > 0) {
console.log(`⚠️ Found ${untrustedOverrides.length} override comment(s) from UNTRUSTED user(s):`);
untrustedOverrides.forEach((comment, index) => {
console.log(` Untrusted override ${index + 1}:`);
console.log(` Author: ${comment.user.login}`);
console.log(` Association: ${comment.author_association}`);
console.log(` Created at: ${comment.created_at}`);
console.log(` Comment ID: ${comment.id}`);
});
console.log(` Trusted associations are: ${trustedAssociations.join(', ')}`);
}
console.log('No valid override comment found');
console.log('No valid override comment found');
core.setOutput('override_found', 'false');
}