Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/codebuild-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,22 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const fs = require('node:fs')

const prNumber = context.issue.number ?? process.env.SDK_PR

const prInfo = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
})

const hasAcknowledgeLabel = prInfo.data.labels.some(label => label.name === 'acknowledge-artifact-size-increase')

const getComments =
`query {
repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){
pullRequest(number: ${context.issue.number ?? process.env.SDK_PR}) {
pullRequest(number: ${prNumber}) {
id
comments(last:100) {
nodes {
Expand Down Expand Up @@ -181,17 +193,31 @@ jobs:
)
await Promise.all(mutations)

const fs = require('node:fs')
const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8')

const writeComment =
`mutation {
addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){
clientMutationId
commentEdge {
node {
id
}
}
}
}`

await github.graphql(writeComment)
const addCommentResponse = await github.graphql(writeComment)
const newCommentId = addCommentResponse.addComment.commentEdge.node.id

if (hasAcknowledgeLabel) {
await github.graphql(
`mutation {
minimizeComment(input:{subjectId:"${newCommentId}", classifier:RESOLVED}){
clientMutationId
}
}`
)
}

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