Skip to content

Commit 0e2fb46

Browse files
committed
WIP: curl investigation
1 parent 9cc4eea commit 0e2fb46

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

.github/workflows/pr-tagging.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
mention-app-authors:
9+
permissions: write-all
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: actions/checkout@v4
@@ -23,8 +24,9 @@ jobs:
2324
- name: Tag app authors
2425
env:
2526
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
PR_NUMBER: ${{ github.event.pull_request.number }}
27-
REPO: ${{ github.repository }} # this is the slug, so user/repo
27+
#PR_NUMBER: ${{ github.event.pull_request.number }}
28+
#REPO: ${{ github.repository }} # this is the slug, so user/repo
29+
COMMENT_URL: https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments
2830
run: |
2931
git diff --name-only origin/master... -- apps/ \
3032
| grep -o 'apps/[^/]*' \
@@ -39,12 +41,18 @@ jobs:
3941
4042
echo "tagging @$author for \`$d\`"
4143
done \
42-
| jq -Rsc '{body: .}' \
43-
| xargs -I{} curl \
44-
-fsSL \
45-
-H "Accept: application/vnd.github+json" \
46-
-H "Authorization: Bearer $GITHUB_TOKEN" \
47-
-H "Content-Type: application/json" \
48-
-H "X-GitHub-Api-Version: 2022-11-28" \
49-
-d {} \
50-
"https://api.github.com/repos/$REPO/issues/$PR_NUMBER/comments"
44+
> comment.txt
45+
46+
- uses: actions/github-script@v7
47+
with:
48+
github-token: ${{secrets.GITHUB_TOKEN}}
49+
script: |
50+
const fs = require("fs");
51+
const comment = fs.readFileSync("comment.txt", "utf8");
52+
53+
github.rest.issues.createComment({
54+
issue_number: context.issue.number,
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
body: comment,
58+
})

0 commit comments

Comments
 (0)