Skip to content

Commit 12268cc

Browse files
alperozturk96AndyScherzinger
authored andcommitted
t2
Signed-off-by: alperozturk <[email protected]>
1 parent f044591 commit 12268cc

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

.github/workflows/android.yml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,20 @@ jobs:
8181
name: app-dev-debug
8282
path: app/build/outputs/apk/dev/debug/app-dev-debug.apk
8383

84-
- name: Upload to Nextcloud and comment
85-
env:
86-
USER: ${{ secrets.NEXTCLOUD_USER }}
87-
PASS: ${{ secrets.NEXTCLOUD_PASSWORD }}
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
BUILD: pr-${{ github.event.pull_request.number }}-${{ github.sha }}
90-
PR: ${{ github.event.pull_request.number }}
91-
PUBLIC_URL: https://www.kaminsky.me/nc-dev/android-artifacts
92-
DAV_URL: https://nextcloud.kaminsky.me/remote.php/dav/files/${{ secrets.NEXTCLOUD_USER }}/android-artifacts
93-
run: |
94-
APK=$(find app/build/outputs/apk/qa/debug -name "qa-debug-*.apk" | head -n1)
95-
[ -f "$APK" ] || { echo "APK not found"; exit 1; }
96-
97-
curl -u "$USER:$PASS" -T "$APK" "$DAV_URL/$BUILD.apk"
98-
qrencode -o "$PR.png" "$PUBLIC_URL/$BUILD.apk"
99-
curl -u "$USER:$PASS" -T "$PR.png" "$DAV_URL/$BUILD.png"
100-
101-
COMMENT="APK file: $PUBLIC_URL/$BUILD.apk\n\n![QR Code]($PUBLIC_URL/$BUILD.png)\n\nTo test this change or fix, download and install the APK above. It can run in parallel to your existing app."
102-
103-
curl -s -X POST \
104-
-H "Authorization: token $GITHUB_TOKEN" \
105-
-H "Content-Type: application/json" \
106-
-d "$(jq -n --arg body "$COMMENT" '{body: $body}')" \
107-
https://api.github.com/repos/${{ github.repository }}/issues/$PR/comments
84+
- name: Comment on PR with artifact link
85+
if: github.event_name == 'pull_request'
86+
uses: actions/github-script@v7
87+
with:
88+
script: |
89+
const runId = process.env.GITHUB_RUN_ID;
90+
const repo = context.repo.repo;
91+
const owner = context.repo.owner;
92+
const prNumber = context.payload.pull_request.number;
93+
const artifactUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}`;
94+
95+
github.rest.issues.createComment({
96+
owner,
97+
repo,
98+
issue_number: prNumber,
99+
body: `🎉 Debug APK built and uploaded! You can download it from the [workflow artifacts](${artifactUrl}).`
100+
});

0 commit comments

Comments
 (0)