Skip to content

Commit 50a1f7f

Browse files
committed
Add Flatpak to comment
1 parent 076c59b commit 50a1f7f

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ jobs:
285285
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
286286
fi
287287
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
288-
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "| 📦 **Windows Build Complete for** $(git rev-parse HEAD) |
289-
|-|
290-
| [Download artifact]($ARTIFACT_URL) |"
288+
BODY="| 📦 **Windows Build Complete for** $(git rev-parse HEAD) |"$'\n'
289+
BODY+="|-|"$'\n'
290+
BODY+="| [Download binary]($ARTIFACT_URL) |"
291+
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$BODY"
291292
fi
292293
293294
- name: 🔑 Azure login
@@ -472,9 +473,10 @@ jobs:
472473
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
473474
fi
474475
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
475-
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "| 📦 **Mac Build Complete for** $(git rev-parse HEAD) |
476-
|-|
477-
| [Download artifact]($ARTIFACT_URL) |"
476+
BODY="| 📦 **Mac Build Complete for** $(git rev-parse HEAD) |"$'\n'
477+
BODY+="|-|"$'\n'
478+
BODY+="| [Download binary]($ARTIFACT_URL) |"
479+
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$BODY"
478480
fi
479481
480482
- name: 🔏 Sign and notarize (preparation)
@@ -593,6 +595,7 @@ jobs:
593595
compression-level: 0
594596

595597
- name: 💬 Comment artifact link on PR
598+
id: linux-comment
596599
if: github.event_name != 'push'
597600
env:
598601
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -605,9 +608,11 @@ jobs:
605608
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
606609
fi
607610
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
608-
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "| 📦 **Linux Build Complete for** $(git rev-parse HEAD) |
609-
|-|
610-
| [Download artifact]($ARTIFACT_URL) |"
611+
BODY="| 📦 **Linux Build Complete for** $(git rev-parse HEAD) |"$'\n'
612+
BODY+="|-|"$'\n'
613+
BODY+="| [Download binary]($ARTIFACT_URL) |"
614+
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments -f body="$BODY" --jq '.id')
615+
echo "comment_id=$COMMENT_ID" >> "$GITHUB_OUTPUT"
611616
fi
612617
613618
- name: 🔧 Install Flatpak tooling
@@ -638,3 +643,18 @@ jobs:
638643
name: graphite-flatpak
639644
path: .flatpak/Graphite.flatpak
640645
compression-level: 0
646+
647+
- name: 💬 Update PR comment with Flatpak artifact link
648+
if: github.event_name != 'push' && steps.linux-comment.outputs.comment_id
649+
env:
650+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
651+
run: |
652+
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-flatpak") | .id')
653+
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
654+
COMMENT_ID="${{ steps.linux-comment.outputs.comment_id }}"
655+
if [ -n "$ARTIFACT_ID" ]; then
656+
EXISTING_BODY=$(gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body')
657+
BODY="$EXISTING_BODY"$'\n'
658+
BODY+="| [Download Flatpak]($ARTIFACT_URL) |"
659+
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH -f body="$BODY"
660+
fi

0 commit comments

Comments
 (0)