File tree 1 file changed +33
-6
lines changed 1 file changed +33
-6
lines changed Original file line number Diff line number Diff line change 69
69
body
70
70
})
71
71
72
- # FIXME: comment hider doesn't work from this file
73
- # - uses: kanga333/comment-hider@9141763feccc8da773595675adc567d6616b6e6f
74
- # name: Hide old comments
75
- # with:
76
- # github_token: ${{ secrets.GITHUB_TOKEN }}
77
- # leave_visible: 1
72
+ # Based on https://github.com/kanga333/comment-hider/blob/9141763feccc8da773595675adc567d6616b6e6f/src/client.ts
73
+ # Can't use kanga333/comment-hider because https://github.com/kanga333/comment-hider/issues/26
74
+ - name : Hide old comments
75
+ uses : actions/github-script@v3
76
+ with :
77
+ github-token : ${{secrets.GITHUB_TOKEN}}
78
+ script : |
79
+ const fs = require('fs')
80
+
81
+ const response = await github.issues.listComments({
82
+ issue_number: fs.readFileSync("pr_number.txt", { encoding: "utf8" }),
83
+ owner: context.repo.owner,
84
+ repo: context.repo.repo,
85
+ })
86
+ const botCommentIds = response.data
87
+ .filter(comment => comment.user.login === 'github-actions[bot]')
88
+ .map(comment => comment.node_id)
89
+ .slice(0, -1) // skip last comment
90
+
91
+ for (const id of botCommentIds) {
92
+ const resp = await github.graphql(`
93
+ mutation {
94
+ minimizeComment(input: {classifier: OUTDATED, subjectId: "${id}"}) {
95
+ minimizedComment {
96
+ isMinimized
97
+ }
98
+ }
99
+ }
100
+ `)
101
+ if (resp.errors) {
102
+ throw new Error(resp.errors)
103
+ }
104
+ }
You can’t perform that action at this time.
0 commit comments