Skip to content

Commit fae2941

Browse files
committed
Use aws-kotlin-repo-tools show-results action
1 parent bf6ce0a commit fae2941

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
@@ -50,56 +50,9 @@ jobs:
5050
run: ./gradlew artifactSizeMetrics
5151
- name: Analyze Artifact Size Metrics
5252
run: ./gradlew analyzeArtifactSizeMetrics
53-
- name: Show Results
54-
uses: actions/github-script@v7
55-
with:
56-
script: |
57-
const getComments =
58-
`query {
59-
repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){
60-
pullRequest(number: ${context.issue.number}) {
61-
id
62-
comments(last:100) {
63-
nodes {
64-
id
65-
body
66-
author {
67-
login
68-
}
69-
isMinimized
70-
}
71-
}
72-
}
73-
}
74-
}`
75-
76-
const response = await github.graphql(getComments)
77-
const comments = response.repository.pullRequest.comments.nodes
78-
79-
const mutations = comments
80-
.filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts'))
81-
.map(comment =>
82-
github.graphql(
83-
`mutation {
84-
minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){
85-
clientMutationId
86-
}
87-
}`
88-
)
89-
)
90-
await Promise.all(mutations)
9153

92-
const fs = require('node:fs')
93-
const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8')
94-
95-
const writeComment =
96-
`mutation {
97-
addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){
98-
clientMutationId
99-
}
100-
}`
101-
102-
await github.graphql(writeComment)
54+
- name: Show Results
55+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main
10356

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

0 commit comments

Comments
 (0)