Last active
June 16, 2023 06:11
-
-
Save bastionkid/3b41693456e908a04ae736690cbfb069 to your computer and use it in GitHub Desktop.
Size Metrics workflow with only size_diff_report job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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