Skip to content

Sync "mypy_primer_comment" action with "typeshed" #12135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sobolevn opened this issue Feb 6, 2022 · 0 comments · Fixed by #12136
Closed

Sync "mypy_primer_comment" action with "typeshed" #12135

sobolevn opened this issue Feb 6, 2022 · 0 comments · Fixed by #12136
Assignees
Labels

Comments

@sobolevn
Copy link
Member

sobolevn commented Feb 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant