Skip to content

Commit 9621ad1

Browse files
authored
misc: use aws-kotlin-repo-tools show-results action (#1268)
1 parent f6e959c commit 9621ad1

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

.github/workflows/artifact-size-metrics.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -62,56 +62,9 @@ jobs:
6262
run: ./gradlew artifactSizeMetrics
6363
- name: Analyze Artifact Size Metrics
6464
run: ./gradlew analyzeArtifactSizeMetrics
65-
- name: Show Results
66-
uses: actions/github-script@v7
67-
with:
68-
script: |
69-
const getComments =
70-
`query {
71-
repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){
72-
pullRequest(number: ${context.issue.number}) {
73-
id
74-
comments(last:100) {
75-
nodes {
76-
id
77-
body
78-
author {
79-
login
80-
}
81-
isMinimized
82-
}
83-
}
84-
}
85-
}
86-
}`
87-
88-
const response = await github.graphql(getComments)
89-
const comments = response.repository.pullRequest.comments.nodes
90-
91-
const mutations = comments
92-
.filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts'))
93-
.map(comment =>
94-
github.graphql(
95-
`mutation {
96-
minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){
97-
clientMutationId
98-
}
99-
}`
100-
)
101-
)
102-
await Promise.all(mutations)
10365

104-
const fs = require('node:fs')
105-
const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8')
106-
107-
const writeComment =
108-
`mutation {
109-
addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){
110-
clientMutationId
111-
}
112-
}`
113-
114-
await github.graphql(writeComment)
66+
- name: Show Results
67+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main
11568

11669
- name: Evaluate
11770
if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }}

0 commit comments

Comments
 (0)