Skip to content

Commit

Permalink
edit comment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
docimin committed Dec 22, 2024
1 parent c00f797 commit 8e0e5cc
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/comment-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
node: [22.x]

steps:
- name: Install GitHub CLI
run: |
curl -fsSL https://cli.github.com/packages/release/gh_2.0.0_linux_amd64.deb -o gh.deb
sudo dpkg -i gh.deb
if: runner.os == 'Linux'

- name: Check comment author permissions
id: check-permissions
run: |
Expand All @@ -44,12 +50,13 @@ jobs:
else
PLATFORM="ios"
fi
echo "::set-output name=comment_id::$(gh api \
COMMENT_ID=$(gh api \
-X POST \
-H 'Accept: application/vnd.github+json' \
'/repos/${{ github.repository }}/issues/comments' \
-f body='Building app for $PLATFORM... This can take about 25 minutes.' \
--jq '.id')"
-f body="Building app for $PLATFORM... This can take about 25 minutes." \
--jq '.id')
echo "comment_id=$COMMENT_ID" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -112,7 +119,7 @@ jobs:
gh api \
-X PATCH \
-H "Accept: application/vnd.github+json" \
"/repos/${{ github.repository }}/issues/comments/${{ steps.comment.outputs.comment_id }}" \
"/repos/${{ github.repository }}/issues/comments/${{ env.comment_id }}" \
-f body="Build complete for $PLATFORM."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -128,7 +135,7 @@ jobs:
gh api \
-X PATCH \
-H "Accept: application/vnd.github+json" \
"/repos/${{ github.repository }}/issues/comments/${{ steps.comment.outputs.comment_id }}" \
"/repos/${{ github.repository }}/issues/comments/${{ env.comment_id }}" \
-f body="Build failed for $PLATFORM."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8e0e5cc

Please sign in to comment.