From c8f1cf9541c5950bdf057f167db5fe6c3c8edc9a Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Wed, 10 Jul 2024 16:10:39 -0400 Subject: [PATCH] cicd: update actions and stale settings from template --- .github/workflows/checks.yaml | 12 +++---- .github/workflows/release.yml | 6 ++-- .github/workflows/reusable-stale.yaml | 46 +++++++++++++++++++++++++++ .github/workflows/stale.yaml | 39 +++++++++++------------ 4 files changed, 74 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/reusable-stale.yaml diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 4d669e0f..f03eff6f 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -9,10 +9,10 @@ jobs: matrix: python-version: ["3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -23,10 +23,10 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.11 @@ -41,10 +41,10 @@ jobs: env: SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4256cfaa..ffdabc3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install pypa/build @@ -25,7 +25,7 @@ jobs: - name: Build a binary wheel and a source tarball run: python3 -m build - name: Store the distribution packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: python-package-distributions path: dist/ @@ -42,7 +42,7 @@ jobs: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - name: Download all the dists - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/ diff --git a/.github/workflows/reusable-stale.yaml b/.github/workflows/reusable-stale.yaml new file mode 100644 index 00000000..0e29bbc5 --- /dev/null +++ b/.github/workflows/reusable-stale.yaml @@ -0,0 +1,46 @@ +name: Reusable Stalebot Workflow + +on: + workflow_call: + inputs: + days-before-close: + default: 14 + type: number + days-before-issue-stale: + required: true + type: number + days-before-pr-stale: + required: true + type: number + exempt-labels: + default: stale-exempt + description: Comma-separated list of labels to exclude from stalebot + type: string + labels: + default: "" + description: Comma-separated list of labels to apply to stalebot + type: string + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - name: Mark issues and PRs as stale + uses: actions/stale@v9 + with: + only-labels: ${{ inputs.labels }} + exempt-issue-labels: ${{ inputs.exempt-labels }} + exempt-pr-labels: ${{ inputs.exempt-labels }} + remove-stale-when-updated: true + days-before-close: ${{ inputs.days-before-close }} + + days-before-issue-stale: ${{ inputs.days-before-issue-stale }} + stale-issue-label: stale + stale-issue-message: This issue is stale because it has been open ${{ inputs.days-before-issue-stale }} days with no activity. This issue will be closed if no further activity occurs in ${{ inputs.days-before-close }} days. + close-issue-label: closed-by-stale + close-issue-message: This issue was closed because it has been stalled for ${{ inputs.days-before-close }} days with no activity. + + days-before-pr-stale: ${{ inputs.days-before-pr-stale }} + stale-pr-label: stale + stale-pr-message: This PR is stale because it has been open ${{ inputs.days-before-pr-stale }} day(s) with no activity. Please review this PR. + days-before-pr-close: -1 diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index 1c96b492..47682f2c 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -2,27 +2,26 @@ name: "Stalebot for issues and PRs" on: schedule: - - cron: "30 13 * * *" + - cron: "30 13 * * 1-5" jobs: - stale: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/stale@v9 - with: - remove-stale-when-updated: true - days-before-close: 14 + stale-high-priority: + uses: ./.github/workflows/reusable-stale.yaml + with: + days-before-issue-stale: 90 + days-before-pr-stale: 1 + labels: priority:high - days-before-issue-stale: 60 - stale-issue-label: stale - stale-issue-message: "This issue is stale because it has been open 45 days with no activity. Please make a comment for triaging or closing the issue." - close-issue-label: closed-by-stale - close-issue-message: "This issue was closed because it has been stalled for 14 days with no activity." + stale-medium-priority: + uses: ./.github/workflows/reusable-stale.yaml + with: + days-before-issue-stale: 135 + days-before-pr-stale: 3 + labels: priority:medium - days-before-pr-stale: 7 - stale-pr-label: stale - stale-pr-message: "This PR is stale because it has been open 7 days with no activity. Please review this PR." - days-before-pr-close: -1 + stale-low-priority: + uses: ./.github/workflows/reusable-stale.yaml + with: + days-before-issue-stale: 180 + days-before-pr-stale: 7 + labels: priority:low