mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Bumps the github-actions group with 4 updates: [crate-ci/typos](https://github.com/crate-ci/typos), [actions/github-script](https://github.com/actions/github-script), [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action) and [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action). Updates `crate-ci/typos` from 1.16.22 to 1.16.23 - [Release notes](https://github.com/crate-ci/typos/releases) - [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md) - [Commits](https://github.com/crate-ci/typos/compare/v1.16.22...v1.16.23) Updates `actions/github-script` from 5 to 6 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v5...v6) Updates `DeterminateSystems/nix-installer-action` from 6 to 7 - [Release notes](https://github.com/determinatesystems/nix-installer-action/releases) - [Commits](https://github.com/determinatesystems/nix-installer-action/compare/v6...v7) Updates `aquasecurity/trivy-action` from 0.13.1 to 0.14.0 - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/f78e9ecf42a1271402d4f484518b9313235990e1...2b6a709cf9c4025c5438138008beaddbb02086f0) --- updated-dependencies: - dependency-name: crate-ci/typos dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: DeterminateSystems/nix-installer-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: aquasecurity/trivy-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
113 lines
4.1 KiB
YAML
113 lines
4.1 KiB
YAML
name: Stale Issue, Banch and Old Workflows Cleanup
|
|
on:
|
|
schedule:
|
|
# Every day at midnight
|
|
- cron: "0 0 * * *"
|
|
workflow_dispatch:
|
|
jobs:
|
|
issues:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
actions: write
|
|
steps:
|
|
- name: stale
|
|
uses: actions/stale@v8.0.0
|
|
with:
|
|
stale-issue-label: "stale"
|
|
stale-pr-label: "stale"
|
|
days-before-stale: 180
|
|
# Pull Requests become stale more quickly due to merge conflicts.
|
|
# Also, we promote minimizing WIP.
|
|
days-before-pr-stale: 7
|
|
days-before-pr-close: 3
|
|
# We rarely take action in response to the message, so avoid
|
|
# cluttering the issue and just close the oldies.
|
|
stale-pr-message: ""
|
|
stale-issue-message: ""
|
|
# Upped from 30 since we have a big tracker and was hitting the limit.
|
|
operations-per-run: 60
|
|
# Start with the oldest issues, always.
|
|
ascending: true
|
|
- name: "Close old issues labeled likely-no"
|
|
uses: actions/github-script@v6
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const thirtyDaysAgo = new Date(new Date().setDate(new Date().getDate() - 30));
|
|
console.log(`Looking for issues labeled with 'likely-no' more than 30 days ago, which is after ${thirtyDaysAgo.toISOString()}`);
|
|
|
|
const issues = await github.rest.issues.listForRepo({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: 'likely-no',
|
|
state: 'open',
|
|
});
|
|
|
|
console.log(`Found ${issues.data.length} open issues labeled with 'likely-no'`);
|
|
|
|
for (const issue of issues.data) {
|
|
console.log(`Checking issue #${issue.number} created at ${issue.created_at}`);
|
|
|
|
const timeline = await github.rest.issues.listEventsForTimeline({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: issue.number,
|
|
});
|
|
|
|
const labelEvent = timeline.data.find(event => event.event === 'labeled' && event.label.name === 'likely-no');
|
|
|
|
if (labelEvent) {
|
|
console.log(`Issue #${issue.number} was labeled with 'likely-no' at ${labelEvent.created_at}`);
|
|
|
|
if (new Date(labelEvent.created_at) < thirtyDaysAgo) {
|
|
console.log(`Issue #${issue.number} is older than 30 days with 'likely-no' label, closing issue.`);
|
|
await github.rest.issues.update({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: issue.number,
|
|
state: 'closed',
|
|
state_reason: 'not planned'
|
|
});
|
|
}
|
|
} else {
|
|
console.log(`Issue #${issue.number} does not have a 'likely-no' label event in its timeline.`);
|
|
}
|
|
}
|
|
|
|
branches:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Run delete-old-branches-action
|
|
uses: beatlabs/delete-old-branches-action@v0.0.10
|
|
with:
|
|
repo_token: ${{ github.token }}
|
|
date: "6 months ago"
|
|
dry_run: false
|
|
delete_tags: false
|
|
# extra_protected_branch_regex: ^(foo|bar)$
|
|
exclude_open_pr_branches: true
|
|
del_runs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Delete PR Cleanup workflow runs
|
|
uses: Mattraks/delete-workflow-runs@v2
|
|
with:
|
|
token: ${{ github.token }}
|
|
repository: ${{ github.repository }}
|
|
retain_days: 30
|
|
keep_minimum_runs: 30
|
|
delete_workflow_pattern: pr-cleanup.yaml
|
|
|
|
- name: Delete PR Deploy workflow skipped runs
|
|
uses: Mattraks/delete-workflow-runs@v2
|
|
with:
|
|
token: ${{ github.token }}
|
|
repository: ${{ github.repository }}
|
|
retain_days: 30
|
|
keep_minimum_runs: 30
|
|
delete_workflow_pattern: pr-deploy.yaml
|