mirror of
https://github.com/Heretek-AI/opencode.git
synced 2026-11-21 21:29:28 -10:00
+21

![opencode-agent[bot]](/assets/img/avatar_default.png)



![opencode-agent[bot]](/assets/img/avatar_default.png)



James Long
Brendan Allan
Kit Langton
opencode-agent[bot]
Affan Ali
affanali2k3
Frank
opencode-agent[bot]
𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴
Aiden Cline
Jay V
Dax Raad
Aarav Sareen
OpeOginni
Luke Parker
Ben Guthrie
Dax
Filip
Max Anderson
Brendan Allan
Jack
Shoubhit Dash
Dustin Deus
starptech
Aiden Cline
usrnk1
Jay
runvip
opencode
Julian Coy
Vladimir Glafirov
8c94e9005f
Co-authored-by: Brendan Allan <[email protected]> Co-authored-by: Kit Langton <[email protected]> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Affan Ali <[email protected]> Co-authored-by: affanali2k3 <[email protected]> Co-authored-by: Frank <[email protected]> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <[email protected]> Co-authored-by: Aiden Cline <[email protected]> Co-authored-by: Jay V <[email protected]> Co-authored-by: Dax Raad <[email protected]> Co-authored-by: Aarav Sareen <[email protected]> Co-authored-by: OpeOginni <[email protected]> Co-authored-by: Luke Parker <[email protected]> Co-authored-by: Ben Guthrie <[email protected]> Co-authored-by: Dax <[email protected]> Co-authored-by: Filip <[email protected]> Co-authored-by: Max Anderson <[email protected]> Co-authored-by: Brendan Allan <[email protected]> Co-authored-by: Jack <[email protected]> Co-authored-by: Shoubhit Dash <[email protected]> Co-authored-by: Dustin Deus <[email protected]> Co-authored-by: starptech <[email protected]> Co-authored-by: Aiden Cline <[email protected]> Co-authored-by: usrnk1 <[email protected]> Co-authored-by: Jay <[email protected]> Co-authored-by: runvip <[email protected]> Co-authored-by: opencode <[email protected]> Co-authored-by: Julian Coy <[email protected]> Co-authored-by: Vladimir Glafirov <[email protected]>
134 lines
4.9 KiB
YAML
134 lines
4.9 KiB
YAML
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`);
|
|
}
|