diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml deleted file mode 100644 index 9afbb38..0000000 --- a/.github/workflows/clean.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: clean - -permissions: - contents: write - pull-requests: read - actions: write - -defaults: - run: - shell: bash - -on: - workflow_dispatch: { } - schedule: - - cron: "0 0 * * *" # every day at 00:00 UTC - -jobs: - clean: - timeout-minutes: 5 - runs-on: ubuntu-22.04 - continue-on-error: true - steps: - - name: Remove Cache - uses: actions/github-script@v7 - with: - # clean up caches, - # ref to https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries, - # and https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache. - script: | - const owner = context.repo.owner - const repo = context.repo.repo - var deleteCaches = new Array() - - // get candidate items. - const { data: cs } = await github.rest.actions.getActionsCacheList({ - owner: owner, - repo: repo, - }); - for (const c of cs.actions_caches) { - // clean closed pull request caches. - if (c.ref.match(/^refs\/pull\/.*$/)) { - var prNum = c.ref.replace(/[^\d]/g, "") - const { data: pr } = await github.rest.pulls.get({ - owner: owner, - repo: repo, - pull_number: prNum, - }) - if (pr.state === 'closed') { - deleteCaches.push(c) - } - continue - } - if ('${{ github.event_name }}' != 'schedule') { - // clean branch caches. - deleteCaches.push(c) - } - } - - // delete - for (const c of deleteCaches) { - await github.rest.actions.deleteActionsCacheById({ - owner: owner, - repo: repo, - cache_id: c.id, - }) - console.log(`cleaned cache "${c.key}"`) - } diff --git a/.github/workflows/close.yml b/.github/workflows/close.yml deleted file mode 100644 index 670c7c3..0000000 --- a/.github/workflows/close.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: close - -permissions: - pull-requests: write - issues: write - -defaults: - run: - shell: bash - -on: - workflow_dispatch: { } - schedule: - - cron: "0 0 * * *" # every day at 00:00 UTC - -jobs: - close: - timeout-minutes: 5 - runs-on: ubuntu-22.04 - continue-on-error: true - steps: - - name: Close Stale Issues and Pull Requests - uses: actions/stale@v9 - with: - days-before-stale: 15 - days-before-close: 14 - exempt-issue-labels: "help wanted,good first issue,bug,bug-qa,enhancement" - stale-issue-label: "stale" - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." - exempt-pr-labels: "bug,bug-qa,enhancement" - exempt-draft-pr: true - stale-pr-label: "stale" - close-pr-message: "This pull request was closed because it has been inactive for 14 days since being marked as stale." - operations-per-run: 10000 diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml new file mode 100644 index 0000000..0b3f8ce --- /dev/null +++ b/.github/workflows/prune.yml @@ -0,0 +1,32 @@ +name: prune + +permissions: + contents: write + pull-requests: write + actions: write + issues: write + +defaults: + run: + shell: bash + +on: + workflow_dispatch: + inputs: + prune: + description: 'Prune all caches' + required: false + type: boolean + default: false + schedule: + - cron: "0 0 * * *" # every day at 00:00 UTC + +jobs: + close-stale-issues-and-prs: + uses: gpustack/.github/.github/workflows/close-stale-issues-and-prs.yml@main + + clean-stale-caches: + uses: gpustack/.github/.github/workflows/clean-stale-caches.yml@main + with: + # allow to prune all caches on demand + prune: ${{ github.event_name != 'schedule' && inputs.prune || false }} diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index bab2a8e..49dc95a 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -36,7 +36,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Sync - uses: gpustack/.github/actions/mirror-release-gitcode@main + uses: gpustack/.github/.github/actions/mirror-release-gitcode@main with: gitcode-username: "${{ secrets.CI_GITCODE_USERNAME }}" gitcode-password: "${{ secrets.CI_GITCODE_PASSWORD }}" @@ -54,7 +54,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Sync - uses: gpustack/.github/actions/mirror-release-gitee@main + uses: gpustack/.github/.github/actions/mirror-release-gitee@main with: gitee-username: "${{ secrets.CI_GITEE_USERNAME }}" gitee-token: "${{ secrets.CI_GITEE_TOKEN }}" @@ -66,7 +66,7 @@ jobs: timeout-minutes: 120 steps: - name: Sync - uses: gpustack/.github/actions/mirror-release-tencent-cos@main + uses: gpustack/.github/.github/actions/mirror-release-tencent-cos@main with: tencent-secret-id: "${{ secrets.CI_TECENTCOS_SECRET_ID }}" tencent-secret-key: "${{ secrets.CI_TECENTCOS_SECRET_KEY }}"