GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/.github/workflows/compliance-close.yml at dev · maximkr/opencode 133 lines (117 loc) · 4.94 KB / Copy pathcompliance-close.ymlFile metadata and controls133 lines (117 loc) · 4.94 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 name: compliance-close on: schedule: # Run every 30 minutes to check for expired compliance windows - cron: "*/30 * * * *" workflow_dispatch: permissions: contents: read issues: write pull-requests: write jobs: close-non-compliant: runs-on: ubuntu-latest steps: - name: Close non-compliant issues and PRs after 2 hours uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: script: | const { data: items } = await github.rest.issues.listForRepo({ owner: context.repo.owner, repo: context.repo.repo, labels: 'needs:compliance', state: 'open', per_page: 100, }); if (items.length === 0) { core.info('No open issues/PRs with needs:compliance label'); return; } const now = Date.now(); const twoHours = 2 * 60 * 60 * 1000; const orgMemberAssociations = new Set(['OWNER', 'MEMBER']); const agentLogin = 'opencode-agent[bot]'; const { data: file } = await github.rest.repos.getContent({ owner: context.repo.owner, repo: context.repo.repo, path: '.github/TEAM_MEMBERS', ref: 'dev', }); const teamMembers = new Set( Buffer.from(file.content, 'base64') .toString() .split('\n') .map((line) => line.trim().toLowerCase()) .filter(Boolean) ); function isExempt(item) { const login = item.user?.login?.toLowerCase(); return ( login === agentLogin || orgMemberAssociations.has(item.author_association) || (login && teamMembers.has(login)) ); } for (const item of items) { const isPR = !!item.pull_request; const kind = isPR ? 'PR' : 'issue'; const login = item.user?.login; if (isExempt(item)) { core.info(`Skipping ${kind} #${item.number}; author ${login || 'unknown'} is exempt`); 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, issue_number: item.number, }); const complianceComment = comments.find(c => c.body.includes('<!-- issue-compliance -->')); if (!complianceComment) continue; const commentAge = now - new Date(complianceComment.created_at).getTime(); if (commentAge < twoHours) { core.info(`${kind} #${item.number} still within 2-hour window (${Math.round(commentAge / 60000)}m elapsed)`); continue; } const closeMessage = isPR ? 'This pull request has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md) within the 2-hour window.\n\nFeel free to open a new pull request that follows our guidelines.' : 'This issue has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md) within the 2-hour window.\n\nFeel free to open a new issue that follows our issue templates.'; await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: item.number, body: closeMessage, }); try { await github.rest.issues.removeLabel({ owner: context.repo.owner, repo: context.repo.repo, issue_number: item.number, name: 'needs:compliance', }); } catch (e) {} if (isPR) { await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, pull_number: item.number, state: 'closed', }); } else { await github.rest.issues.update({ owner: context.repo.owner, repo: context.repo.repo, issue_number: item.number, state: 'closed', state_reason: 'not_planned', }); } core.info(`Closed non-compliant ${kind} #${item.number} after 2-hour window`); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |