Skip to content

Commit 42de9e1

Browse files
authored
misc: use aws-kotlin-repo-tools show-results action (#1567)
1 parent 2ecfff8 commit 42de9e1

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

.github/workflows/codebuild-ci.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -142,56 +142,9 @@ jobs:
142142
./gradlew collectDelegatedArtifactSizeMetrics -PpullRequest=$PULL_REQUEST
143143
- name: Analyze Artifact Size Metrics
144144
run: ./gradlew analyzeArtifactSizeMetrics
145-
- name: Show Results
146-
uses: actions/github-script@v7
147-
with:
148-
script: |
149-
const getComments =
150-
`query {
151-
repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){
152-
pullRequest(number: ${context.issue.number ?? process.env.SDK_PR}) {
153-
id
154-
comments(last:100) {
155-
nodes {
156-
id
157-
body
158-
author {
159-
login
160-
}
161-
isMinimized
162-
}
163-
}
164-
}
165-
}
166-
}`
167-
168-
const response = await github.graphql(getComments)
169-
const comments = response.repository.pullRequest.comments.nodes
170-
171-
const mutations = comments
172-
.filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts'))
173-
.map(comment =>
174-
github.graphql(
175-
`mutation {
176-
minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){
177-
clientMutationId
178-
}
179-
}`
180-
)
181-
)
182-
await Promise.all(mutations)
183145

184-
const fs = require('node:fs')
185-
const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8')
186-
187-
const writeComment =
188-
`mutation {
189-
addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){
190-
clientMutationId
191-
}
192-
}`
193-
194-
await github.graphql(writeComment)
146+
- name: Show Results
147+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main
195148

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

0 commit comments

Comments
 (0)