diff --git a/.github/workflows/hangar.yml b/.github/workflows/hangar.yml new file mode 100644 index 0000000..f89a3d0 --- /dev/null +++ b/.github/workflows/hangar.yml @@ -0,0 +1,34 @@ +name: Update Hangar Page + +on: + push: + branches: + - main + +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 "::set-output name=token::$TOKEN" + + - name: Update Project for Hangar + run: | + README_CONTENT=$(cat README.md | jq -Rs .) + curl -s -X PATCH "https://hangar.papermc.io/api/v1/pages/editmain/ToolStats" \ + -H "content-type: application/json" \ + -H "Authorization: HangarAuth ${{ steps.authenticate.outputs.token }}" \ + -d "{\"content\":$README_CONTENT}" \ No newline at end of file diff --git a/README.md b/README.md index 9104232..a6267eb 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ ToolStats is a Paper plugin that display various stats about tools. This plugin is inspired off of [GearStats](https://www.spigotmc.org/resources/gearstats.12960/). You can disable/enable which stats are shown on which tools via the config. Note: stats are tracked regardless of config setting. The config is to disable the lore on the item. +test :3 + Here is everything it tracks: * Blocks mined (pickaxes, shovels, axes, hoes, shears) * Crops mined (hoes)