diff --git a/.github/workflows/community_metrics.yml b/.github/workflows/community_metrics.yml index 720799ab124..5005475e9f0 100644 --- a/.github/workflows/community_metrics.yml +++ b/.github/workflows/community_metrics.yml @@ -70,7 +70,20 @@ jobs: shell: pwsh run: | Get-Content ./community_metrics.md >> $env:GITHUB_STEP_SUMMARY - + + - name: Close Previous Issue + shell: pwsh + run: | + # Without the --repo switch, the GH CLI will try to look it up from the current clone, which doesn't exist + # because we don't otherwise need checkout. + $issues = gh issue list --repo '${{ github.repository }}' --label 'community metrics' --state open --json number --jq '.[].number' + foreach ($issue in $issues) + { + gh issue close $issue --repo '${{ github.repository }}' --comment 'Closing this issue as newer community metrics are available.' + } + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Issue # v5.0.0 uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94