Skip to content

Commit ca462c2

Browse files
committed
hangar API
1 parent f85c005 commit ca462c2

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/hangar.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Update Hangar Description
2+
on:
3+
push:
4+
branches: [ master ]
5+
jobs:
6+
update-hangar-page:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Authenticate with Hangar
14+
id: authenticate
15+
run: |
16+
RESPONSE=$(curl -s -X POST "https://hangar.papermc.io/api/v1/authenticate?apiKey=${{ secrets.HANGAR }}" -H 'accept: application/json')
17+
TOKEN=$(echo $RESPONSE | jq -r '.token')
18+
if [[ "$TOKEN" == "null" ]]; then
19+
echo "Error: Unable to fetch JWT token"
20+
exit 1
21+
fi
22+
echo "::add-mask::$TOKEN"
23+
echo "token=$TOKEN" >> $GITHUB_OUTPUT
24+
25+
- name: Update Project Description
26+
run: |
27+
README_CONTENT=$(cat README.md | jq -Rs .)
28+
curl -s -X PATCH "https://hangar.papermc.io/api/v1/pages/editmain/VelocityBlockVersion" \
29+
-H "content-type: application/json" \
30+
-H "Authorization: HangarAuth ${{ steps.authenticate.outputs.token }}" \
31+
-d "{\"content\":$README_CONTENT}"

.github/workflows/modrinth.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: Update Modrinth Description
12
on:
23
push:
34
branches: [ master ]

0 commit comments

Comments
 (0)