mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-05-26 10:08:04 +02:00
ff3634e6cc
Bumps the github-actions group with 6 updates: | Package | From | To | | --- | --- | --- | | [actions/github-script](https://github.com/actions/github-script) | `7.1.0` | `9.0.0` | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `4.0.0` | `4.1.0` | | [docker/login-action](https://github.com/docker/login-action) | `4.1.0` | `4.2.0` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `7.1.0` | `7.2.0` | | [anomalyco/opencode](https://github.com/anomalyco/opencode) | `1.15.3` | `1.15.10` | | [actions/stale](https://github.com/actions/stale) | `10.2.0` | `10.3.0` | Updates `actions/github-script` from 7.1.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/f28e40c7f34bde8b3046d885e986cb6290c5673b...3a2844b7e9c422d3c10d287c895573f7108da1b3) Updates `docker/setup-buildx-action` from 4.0.0 to 4.1.0 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd...d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5) Updates `docker/login-action` from 4.1.0 to 4.2.0 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/4907a6ddec9925e35a0a9e82d7399ccc52663121...650006c6eb7dba73a995cc03b0b2d7f5ca915bee) Updates `docker/build-push-action` from 7.1.0 to 7.2.0 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/bcafcacb16a39f128d818304e6c9c0c18556b85f...f9f3042f7e2789586610d6e8b85c8f03e5195baf) Updates `anomalyco/opencode` from 1.15.3 to 1.15.10 - [Release notes](https://github.com/anomalyco/opencode/releases) - [Commits](https://github.com/anomalyco/opencode/compare/37f89b742907c43b20d38b68eabe65981a59690a...d74d166acf40e51146f8547216913a4e787a4bc1) Updates `actions/stale` from 10.2.0 to 10.3.0 - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/b5d41d4e1d5dceea10e7104786b73624c18a190f...eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/setup-buildx-action dependency-version: 4.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: docker/login-action dependency-version: 4.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: docker/build-push-action dependency-version: 7.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: anomalyco/opencode dependency-version: 1.15.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: actions/stale dependency-version: 10.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
109 lines
4.2 KiB
YAML
109 lines
4.2 KiB
YAML
name: Compliance Close
|
|
|
|
on:
|
|
schedule:
|
|
# Every 30 minutes; the actual close decision uses comment age, so the cron
|
|
# cadence only bounds how stale the closure can get past the 24-hour mark.
|
|
- cron: "*/30 * * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
close-non-compliant:
|
|
if: github.repository == 'zhom/donutbrowser'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Close non-compliant issues and PRs after 24 hours
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.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 window_ms = 24 * 60 * 60 * 1000;
|
|
|
|
for (const item of items) {
|
|
const isPR = !!item.pull_request;
|
|
const kind = isPR ? 'PR' : 'issue';
|
|
|
|
const { data: comments } = await github.rest.issues.listComments({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: item.number,
|
|
});
|
|
|
|
// Use the OLDEST compliance sentinel as the start of the 24-hour
|
|
// window so back-and-forth edits don't reset the clock.
|
|
const sentinel = comments
|
|
.filter(c => c.body && c.body.includes('<!-- issue-compliance -->'))
|
|
.sort((a, b) => new Date(a.created_at) - new Date(b.created_at))[0];
|
|
|
|
if (!sentinel) {
|
|
core.info(`${kind} #${item.number} has needs:compliance label but no compliance comment; skipping`);
|
|
continue;
|
|
}
|
|
|
|
const age_ms = now - new Date(sentinel.created_at).getTime();
|
|
if (age_ms < window_ms) {
|
|
const hours = (age_ms / (60 * 60 * 1000)).toFixed(1);
|
|
core.info(`${kind} #${item.number} still within 24-hour window (${hours}h elapsed)`);
|
|
continue;
|
|
}
|
|
|
|
const closeMessage = isPR
|
|
? 'This pull request has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/main/CONTRIBUTING.md) within the 24-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/main/CONTRIBUTING.md) within the 24-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) {
|
|
core.info(`Could not remove needs:compliance label from #${item.number}: ${e.message}`);
|
|
}
|
|
|
|
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 24-hour window`);
|
|
}
|