diff --git a/.github/actions/setup-test-environment/action.yml b/.github/actions/setup-test-environment/action.yml index 35b4be9..0e25c75 100644 --- a/.github/actions/setup-test-environment/action.yml +++ b/.github/actions/setup-test-environment/action.yml @@ -31,7 +31,7 @@ runs: run: uv sync --frozen - name: Setup Node.js - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: '20' cache: npm diff --git a/.github/workflows/issue-stats.yml b/.github/workflows/issue-stats.yml new file mode 100644 index 0000000..0f165a4 --- /dev/null +++ b/.github/workflows/issue-stats.yml @@ -0,0 +1,42 @@ +name: Monthly issue metrics +on: + workflow_dispatch: + schedule: + - cron: '3 2 1 * *' + +permissions: + contents: read + +jobs: + build: + name: issue metrics + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: read + steps: + - name: Get dates for last month + shell: bash + run: | + # Calculate the first day of the previous month + first_day=$(date -d "last month" +%Y-%m-01) + + # Calculate the last day of the previous month + last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) + + #Set an environment variable with the date range + echo "$first_day..$last_day" + echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" + + - name: Run issue-metrics tool + uses: github/issue-metrics@c640329f02bd24b12b91d51cd385f0b1c25cefb9 # v3.25.1 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SEARCH_QUERY: 'repo:ivuorinen/actions is:issue created:${{ env.last_month }} -reason:"not planned"' + + - name: Create issue + uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6.0.0 + with: + title: Monthly issue metrics report + token: ${{ secrets.GITHUB_TOKEN }} + content-filepath: ./issue_metrics.md diff --git a/node-setup/action.yml b/node-setup/action.yml index e8c998d..2686885 100644 --- a/node-setup/action.yml +++ b/node-setup/action.yml @@ -266,7 +266,7 @@ runs: - name: Setup Node.js id: setup - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: ${{ steps.version.outputs.detected-version }} registry-url: ${{ inputs.registry-url }} diff --git a/stale/action.yml b/stale/action.yml index a1b7469..c23c570 100644 --- a/stale/action.yml +++ b/stale/action.yml @@ -38,18 +38,12 @@ runs: steps: - name: Validate Inputs id: validate - shell: bash - env: - GITHUB_TOKEN: ${{ inputs.token }} - run: | - set -euo pipefail - - # Check for obvious token misconfigurations - if [[ -z "$GITHUB_TOKEN" ]] || [[ "$GITHUB_TOKEN" == *'${{'* ]] || [[ "$GITHUB_TOKEN" == 'secrets.'* ]]; then - echo "::warning::GitHub token appears to be unevaluated or misconfigured. Please provide a valid token." - fi - - echo "Input validation completed successfully" + uses: ./validate-inputs + with: + action: 'stale' + token: ${{ inputs.token }} + days-before-stale: ${{ inputs.days-before-stale }} + days-before-close: ${{ inputs.days-before-close }} - name: 🚀 Run stale id: stale diff --git a/validate-inputs/action.yml b/validate-inputs/action.yml index a23b798..7889ea9 100644 --- a/validate-inputs/action.yml +++ b/validate-inputs/action.yml @@ -95,6 +95,12 @@ inputs: parallel-builds: description: 'Number of parallel builds' required: false + days-before-stale: + description: 'Number of days before marking as stale' + required: false + days-before-close: + description: 'Number of days before closing stale items' + required: false # File/path inputs pre-commit-config: @@ -218,6 +224,8 @@ runs: INPUT_IMAGE_QUALITY: ${{ inputs.image-quality }} INPUT_PNG_QUALITY: ${{ inputs.png-quality }} INPUT_PARALLEL_BUILDS: ${{ inputs.parallel-builds }} + INPUT_DAYS_BEFORE_STALE: ${{ inputs.days-before-stale }} + INPUT_DAYS_BEFORE_CLOSE: ${{ inputs.days-before-close }} INPUT_PRE_COMMIT_CONFIG: ${{ inputs.pre-commit-config }} INPUT_BASE_BRANCH: ${{ inputs.base-branch }} INPUT_DRY_RUN: ${{ inputs.dry-run }}