Ver Fonte

fix: exempt org issues from compliance close (#34431)

opencode-agent[bot] há 2 meses atrás
pai
commit
6d9539f469

+ 14 - 0
.github/workflows/compliance-close.yml

@@ -34,11 +34,25 @@ jobs:
 
             const now = Date.now();
             const twoHours = 2 * 60 * 60 * 1000;
+            const orgMemberAssociations = new Set(['OWNER', 'MEMBER']);
 
             for (const item of items) {
               const isPR = !!item.pull_request;
               const kind = isPR ? 'PR' : 'issue';
 
+              if (orgMemberAssociations.has(item.author_association)) {
+                core.info(`Skipping ${kind} #${item.number}; author association is ${item.author_association}`);
+                try {
+                  await github.rest.issues.removeLabel({
+                    owner: context.repo.owner,
+                    repo: context.repo.repo,
+                    issue_number: item.number,
+                    name: 'needs:compliance',
+                  });
+                } catch (e) {}
+                continue;
+              }
+
               const { data: comments } = await github.rest.issues.listComments({
                 owner: context.repo.owner,
                 repo: context.repo.repo,

+ 7 - 1
.github/workflows/duplicate-issues.yml

@@ -38,6 +38,7 @@ jobs:
           opencode run -m opencode/claude-sonnet-4-6 "A new issue has been created:
 
           Issue number: ${{ github.event.issue.number }}
+          Issue author association: ${{ github.event.issue.author_association }}
 
           Lookup this issue with gh issue view ${{ github.event.issue.number }}.
 
@@ -49,6 +50,8 @@ jobs:
 
           Check whether the issue follows our contributing guidelines and issue templates.
 
+          If the issue author association is OWNER or MEMBER, skip this compliance check. Do not add the needs:compliance label for organization-owned issues.
+
           This project has three issue templates that every issue MUST use one of:
 
           1. Bug Report - requires a Description field with real content
@@ -83,7 +86,7 @@ jobs:
 
           Based on your findings, post a SINGLE comment on issue #${{ github.event.issue.number }}. Build the comment as follows:
 
-          If the issue is NOT compliant, start the comment with:
+          If the issue is NOT compliant and the author association is not OWNER or MEMBER, start the comment with:
           <!-- issue-compliance -->
           Then explain what needs to be fixed and that they have 2 hours to edit the issue before it is automatically closed. Also add the label needs:compliance to the issue using: gh issue edit ${{ github.event.issue.number }} --add-label needs:compliance
 
@@ -148,9 +151,12 @@ jobs:
             }
         run: |
           opencode run -m opencode/claude-sonnet-4-6 "Issue #${{ github.event.issue.number }} was previously flagged as non-compliant and has been edited.
+          Issue author association: ${{ github.event.issue.author_association }}
 
           Lookup this issue with gh issue view ${{ github.event.issue.number }}.
 
+          If the issue author association is OWNER or MEMBER, remove the needs:compliance label if present, delete the previous compliance comment if present, and do not post a new comment.
+
           Re-check whether the issue now follows our contributing guidelines and issue templates.
 
           This project has three issue templates that every issue MUST use one of: