mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
Re-enable API proposal version check (#300716)
* Revert "Merge pull request #300495 from mjbvz/dev/mjbvz/fierce-hawk" This reverts commit2eefd9e554, reversing changes made to34bfd71aea. * 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:
64
.github/workflows/api-proposal-version-check.yml
vendored
64
.github/workflows/api-proposal-version-check.yml
vendored
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user