using 3rd party download artifact action to allow downloading artifacts from the current workflow

This commit is contained in:
Adam Brown 2022-03-18 20:03:38 +00:00
parent fb878375cd
commit fd4566c234
2 changed files with 13 additions and 6 deletions

View File

@ -38,11 +38,16 @@ jobs:
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Save Size
env:
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
run: |
mkdir -p ./apk_size
echo $(./tools/check-size.sh | tail -1 | cut -d ',' -f2-) > ./apk_size/size.txt
echo $PULL_REQUEST_NUMBER > ./apk_size/pr_number.txt
- uses: actions/upload-artifact@v3
with:
name: apk-size
path: apk_size/size.txt
path: |
apk_size/size.txt
apk_size/pr_number.txt
retention-days: 5

View File

@ -15,28 +15,30 @@ jobs:
github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/download-artifact@v3
- uses: dawidd6/action-download-artifact@v2
with:
name: apk-size
path: ~/apk-size.txt
workflow: ${{ github.event.workflow_run.workflow_id }}
- name: Check release size
run: |
echo "::set-output name=APK_SIZE::$(cat ~/apk-size.txt)"
ls -R
echo "::set-output name=APK_SIZE::$(cat size.txt)"
echo "::set-output name=PR_NUMBER::$(cat pr_number.txt)"
id: size
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
issue-number: ${{ steps.size.outputs.PR_NUMBER }}
comment-author: 'github-actions[bot]'
body-includes: APK Size
- name: Publish size to PR
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
issue-number: ${{ steps.size.outputs.PR_NUMBER }}
body: |
APK Size: ${{ steps.size.outputs.APK_SIZE }}
edit-mode: replace