3838 - name : Save Artifact Size Metrics
3939 run : ./gradlew saveArtifactSizeMetrics -Prelease=${{ github.event.release.tag_name }}
4040 - name : Put Artifact Size Metrics in CloudWatch
41- run : ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }}
42- size-check :
43- if : github.event_name == 'pull_request'
44- runs-on : ubuntu-latest
45- steps :
46- - name : Checkout Sources
47- uses : actions/checkout@v4
48-
49- - name : Setup build
50- uses : .github/actions/setup-build
51-
52- - name : Configure AWS Credentials
53- uses : aws-actions/configure-aws-credentials@v4
54- with :
55- role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
56- aws-region : us-west-2
57-
58- - name : Configure Gradle
59- uses : awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
60-
61- - name : Generate Artifact Size Metrics
62- run : ./gradlew -Paws.kotlin.native=false artifactSizeMetrics
63-
64- - name : Analyze Artifact Size Metrics
65- run : ./gradlew analyzeArtifactSizeMetrics
66-
67- - name : Show Results
68- uses : actions/github-script@v7
69- with :
70- script : |
71- const getComments =
72- `query {
73- repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){
74- pullRequest(number: ${context.issue.number}) {
75- id
76- comments(last:100) {
77- nodes {
78- id
79- body
80- author {
81- login
82- }
83- isMinimized
84- }
85- }
86- }
87- }
88- }`
89-
90- const response = await github.graphql(getComments)
91- const comments = response.repository.pullRequest.comments.nodes
92-
93- const mutations = comments
94- .filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts'))
95- .map(comment =>
96- github.graphql(
97- `mutation {
98- minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){
99- clientMutationId
100- }
101- }`
102- )
103- )
104- await Promise.all(mutations)
105-
106- const fs = require('node:fs')
107- const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8')
108-
109- const writeComment =
110- `mutation {
111- addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){
112- clientMutationId
113- }
114- }`
115-
116- await github.graphql(writeComment)
117-
118- - name : Evaluate
119- if : ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }}
120- run : |
121- cd build/reports/metrics
122- cat has-significant-change.txt | grep false || {
123- echo An artifact increased in size by more than allowed or a new artifact was created.
124- echo If this is expected please add the 'acknowledge-artifact-size-increase' label to this pull request.
125- exit 1
126- }
41+ run : ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }}
0 commit comments