Skip to content

Commit 05a26ee

Browse files
committed
#1: Use DARMA-tasking/comment-on-pr for test
1 parent 5318057 commit 05a26ee

File tree

1 file changed

+12
-44
lines changed

1 file changed

+12
-44
lines changed

.github/workflows/test_action.yml

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,15 @@ jobs:
2828
github_token: ${{ secrets.GITHUB_TOKEN }}
2929

3030
- name: Update or add PR comment
31-
env:
32-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
PR: ${{ github.event.pull_request.number }}
34-
REPO: ${{ github.repository }}
35-
run: |
36-
set -euo pipefail
37-
38-
BADGE_DIR="wiki/${REPO}"
39-
PREFIX="https://github.com/${REPO}/${BADGE_DIR}/"
40-
41-
COMMENT=""
42-
43-
if [ -d "$BADGE_DIR" ]; then
44-
for f in "$BADGE_DIR"/*.svg; do
45-
[ -e "$f" ] || continue
46-
FILE=$(basename "$f")
47-
COMMENT+="[![](${PREFIX}${FILE})]() "
48-
done
49-
fi
50-
51-
COMMENT+="<!-- BadgeGeneratorComment -->"
52-
53-
# escape newlines for JSON
54-
JSON_BODY=$(printf '%s' "$COMMENT" | jq -Rs .)
55-
56-
COMMENTS=$(curl -s -H "Authorization: token $GH_TOKEN" \
57-
-H "Accept: application/vnd.github.v3+json" \
58-
"https://api.github.com/repos/${REPO}/issues/${PR}/comments")
59-
60-
ID=$(echo "$COMMENTS" | jq -r '.[] | select(.body|contains("<!-- BadgeGeneratorComment -->")) | .id')
61-
62-
if [ -n "$ID" ]; then
63-
curl -s -X PATCH \
64-
-H "Authorization: token $GH_TOKEN" \
65-
-H "Accept: application/vnd.github.v3+json" \
66-
-d "{\"body\":$JSON_BODY}" \
67-
"https://api.github.com/repos/${REPO}/issues/comments/${ID}"
68-
else
69-
curl -s -X POST \
70-
-H "Authorization: token $GH_TOKEN" \
71-
-H "Accept: application/vnd.github.v3+json" \
72-
-d "{\"body\":$JSON_BODY}" \
73-
"https://api.github.com/repos/${REPO}/issues/${PR}/comments"
74-
fi
31+
uses: DARMA-tasking/comment-on-pr@master
32+
with:
33+
repo_owner: ${{ github.event.repository.owner.login }}
34+
repo_name: ${{ github.event.repository.name }}
35+
pr_number: ${{ github.event.pull_request.number }}
36+
comment_title: "Generated badges"
37+
comment_content: |
38+
[![](https://github.com/DARMA-tasking/badge-generator/wiki/DARMA-tasking/badge-generator/vt-build-amd64-alpine-3-16-clang-cpp-badge.svg)]()
39+
[![](https://github.com/DARMA-tasking/badge-generator/wiki/DARMA-tasking/badge-generator/vt-build-amd64-ubuntu-20-04-gcc-9-cuda-12-2-0-cpp-badge.svg)]()
40+
[![](https://github.com/DARMA-tasking/badge-generator/wiki/DARMA-tasking/badge-generator/vt-build-amd64-ubuntu-20-04-gcc-10-openmpi-cpp-spack-badge.svg)]()
41+
[![](https://github.com/DARMA-tasking/badge-generator/wiki/DARMA-tasking/badge-generator/vt-build-amd64-ubuntu-22-04-gcc-12-cpp-badge.svg)]()
42+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)