Skip to content

Commit 9eb08ab

Browse files
committed
Used KSB app
1 parent 7d35227 commit 9eb08ab

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/sync-ai-personas-releases-to-project-repo.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ jobs:
1212
contents: read
1313
env:
1414
REPO_SYNC_PAT: ${{ secrets.REPO_SYNC_PAT }}
15+
1516
steps:
17+
- name: Generate KSB token
18+
id: ksb-token
19+
uses: actions/create-github-app-token@v3.0.0
20+
with:
21+
app-id: ${{ secrets.KSB_APP_ID }}
22+
private-key: ${{ secrets.KSB_PRIVATE_KEY }}
23+
owner: KudoAI
24+
1625
- name: Sync release to KudoAI/ai-personas
1726
run: |
1827
RELEASE_TITLE="${{ github.event.release.name }}"
@@ -58,7 +67,7 @@ jobs:
5867
printf '{"tag_name": "%s","name": "%s","body": "%s"}' \
5968
"$TARGET_RELEASE_TAG" "$TARGET_RELEASE_TITLE" "$RELEASE_NOTES")
6069
create_release_resp=$(
61-
curl -s -S -X POST -H "Authorization: token $REPO_SYNC_PAT" \
70+
curl -s -S -X POST -H "Authorization: Bearer ${{ steps.ksb-token.outputs.token }}" \
6271
-H "Content-Type: application/json" -d "$create_release_payload" "$create_release_url")
6372
if echo "$create_release_resp" | grep -q '"message"' ; then
6473
echo "ERROR: Failed to create release: $create_release_resp"
@@ -72,13 +81,13 @@ jobs:
7281
printf '{"name": "%s","body": "%s"}' \
7382
"$TARGET_RELEASE_TITLE" "$RELEASE_NOTES")
7483
patch_release_resp=$(
75-
curl -s -S -X PATCH -H "Authorization: token $REPO_SYNC_PAT" \
84+
curl -s -S -X PATCH -H "Authorization: Bearer ${{ steps.ksb-token.outputs.token }}" \
7685
-H "Content-Type: application/json" -d "$update_release_payload" "$update_release_url")
7786
if echo "$patch_release_resp" | grep -q '"message"' ; then
7887
echo "ERROR: Failed to update release: $patch_release_resp"
7988
exit 1
8089
fi
81-
get_release_resp=$(curl -s -S -H "Authorization: token $REPO_SYNC_PAT" \
90+
get_release_resp=$(curl -s -S -H "Authorization: Bearer ${{ steps.ksb-token.outputs.token }}" \
8291
"https://api.github.com/repos/KudoAI/ai-personas/releases/tags/$TARGET_RELEASE_TAG")
8392
upload_url=$(echo "$get_release_resp" | sed -nE 's|.*"upload_url": "(.*)".*|\1|p' | sed 's|{.*}||')
8493
fi

0 commit comments

Comments
 (0)