diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6a09098..daade59 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -19,7 +19,7 @@ jobs: contents: write id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-tags: true diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index 2d639b4..7a8f85e 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -46,3 +46,47 @@ jobs: `---\n_Opened automatically by the Maintenance workflow._`, labels: ['maintenance'], }); + + close-issue-on-success: + needs: ci + if: success() + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + // Close any open maintenance issues — the most recent CI run + // proves the underlying problem is resolved. Without this job + // the issues opened by `open-issue-on-failure` linger forever + // and the repo looks broken to outside visitors even after the + // fix lands. + const open = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: 'maintenance', + }); + if (open.data.length === 0) { + console.log('No open maintenance issues to close.'); + return; + } + const run = await github.rest.actions.getWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.runId, + }); + for (const issue of open.data) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + body: `Maintenance CI is green again — closing automatically.\n\n**Run:** ${run.data.html_url}`, + }); + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + state: 'closed', + }); + console.log(`Closed issue #${issue.number}`); + } diff --git a/src/my_mcp_server/__main__.py b/src/my_mcp_server/__main__.py index 8633a6c..3a27a02 100644 --- a/src/my_mcp_server/__main__.py +++ b/src/my_mcp_server/__main__.py @@ -1,7 +1,7 @@ """Allow running as ``python -m my_mcp_server``.""" -import sys import logging +import sys from my_mcp_server.server import main