Skip to content

Sync "mypy_primer_comment" action with "typeshed" #12135

Closed
@sobolevn

Description

@sobolevn

Right now typeshed and mypy have different techniques to hide old comments:

  • typeshed: https://github.com/python/typeshed/blob/62e33cbbd53e55334f5da8870f8f4b3ae8679ac2/.github/workflows/mypy_primer_comment.yml#L70-L76
  • mypy:
    # Based on https://github.com/kanga333/comment-hider
    - name: Hide old comments
    uses: actions/github-script@v3
    with:
    github-token: ${{secrets.GITHUB_TOKEN}}
    script: |
    const fs = require('fs')
    const response = await github.issues.listComments({
    issue_number: fs.readFileSync("pr_number.txt", { encoding: "utf8" }),
    owner: context.repo.owner,
    repo: context.repo.repo,
    })
    const botCommentIds = response.data
    .filter(comment => comment.user.login === 'github-actions[bot]')
    .map(comment => comment.node_id)
    for (const id of botCommentIds) {
    const resp = await github.graphql(`
    mutation {
    minimizeComment(input: {classifier: OUTDATED, subjectId: "${id}"}) {
    minimizedComment {
    isMinimized
    }
    }
    }
    `)
    if (resp.errors) {
    throw new Error(resp.errors)
    }
    }

I need to research whether these two are identical.
Maybe we can simplify mypy's action to be the same as typeshed's one.

Origin: #12125

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions