Skip to content

Commit

Permalink
hangar API
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperdefined committed Dec 31, 2024
1 parent 00ddf8c commit d40b41d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/hangar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Update Hangar Description
on:
push:
branches: [ master ]
jobs:
update-hangar-page:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Authenticate with Hangar
id: authenticate
run: |
RESPONSE=$(curl -s -X POST "https://hangar.papermc.io/api/v1/authenticate?apiKey=${{ secrets.HANGAR }}" -H 'accept: application/json')
TOKEN=$(echo $RESPONSE | jq -r '.token')
if [[ "$TOKEN" == "null" ]]; then
echo "Error: Unable to fetch JWT token"
exit 1
fi
echo "::add-mask::$TOKEN"
echo "token=$TOKEN" >> $GITHUB_OUTPUT
- name: Update Project Description
run: |
README_CONTENT=$(cat README.md | jq -Rs .)
curl -s -X PATCH "https://hangar.papermc.io/api/v1/pages/editmain/AnarchyStats" \
-H "content-type: application/json" \
-H "Authorization: HangarAuth ${{ steps.authenticate.outputs.token }}" \
-d "{\"content\":$README_CONTENT}"
1 change: 1 addition & 0 deletions .github/workflows/modrinth.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Update Modrinth Description
on:
push:
branches: [ master ]
Expand Down

0 comments on commit d40b41d

Please sign in to comment.