Skip to content

Instantly share code, notes, and snippets.

@bastionkid
Last active June 16, 2023 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastionkid/3b41693456e908a04ae736690cbfb069 to your computer and use it in GitHub Desktop.
Save bastionkid/3b41693456e908a04ae736690cbfb069 to your computer and use it in GitHub Desktop.
Size Metrics workflow with only size_diff_report job
name: Size Metrics
...
# content is omitted as it's already shown earlier
...
env:
size_diff_report_file: apk_size_diff_report.html
jobs:
build:
...
# content is omitted as it's already shown earlier
...
size_diff_report:
...
# content is omitted as it's already shown earlier
...
pr_comment:
needs: size_diff_report
name: PR Comment (Size Report)
runs-on: ubuntu-latest
steps:
# Step 1
- uses: actions/download-artifact@v3
with:
name: ${{ env.size_diff_report_file }}
# Step 2
- name: Add PR Comment
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
try {
const filePath = 'apk_size_diff_report.html'
const sizeReportContent = fs.readFileSync(filePath, 'utf8')
const result = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: sizeReportContent
})
console.log(result)
} catch (error) {
console.error('Error reading file:', error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment