89 lines
3.1 KiB
YAML
89 lines
3.1 KiB
YAML
name: debug-api
|
|
|
|
on:
|
|
push:
|
|
branches: ['*']
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test-api:
|
|
runs-on: ubuntu-latest
|
|
container: catthehacker/ubuntu:act-latest
|
|
|
|
steps:
|
|
- name: System info
|
|
run: |
|
|
echo "=== curl version ==="
|
|
curl --version
|
|
echo ""
|
|
echo "=== wget version ==="
|
|
wget --version | head -3
|
|
echo ""
|
|
echo "=== DNS check ==="
|
|
cat /etc/resolv.conf
|
|
echo ""
|
|
echo "=== route to git.dungeon.red ==="
|
|
getent hosts git.dungeon.red || echo "getent failed"
|
|
|
|
- name: Test GET (no auth)
|
|
run: |
|
|
echo "=== Simple GET to API root ==="
|
|
curl -v https://git.dungeon.red/api/v1/version 2>&1 | head -50
|
|
|
|
- name: Test GET with auth
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
run: |
|
|
echo "Token length: ${#FORGEJO_TOKEN}"
|
|
echo ""
|
|
echo "=== GET /user with auth ==="
|
|
curl -v -H "Authorization: token ${FORGEJO_TOKEN}" \
|
|
https://git.dungeon.red/api/v1/user 2>&1 | head -60
|
|
|
|
- name: Test POST with file body
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
run: |
|
|
echo '{"tag_name":"debug-test","name":"debug-test"}' > /tmp/body.json
|
|
cat /tmp/body.json
|
|
echo ""
|
|
echo "=== POST with --data-binary @file ==="
|
|
curl -v --http1.1 -X POST \
|
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
--data-binary @/tmp/body.json \
|
|
"https://git.dungeon.red/api/v1/repos/${{ github.repository }}/releases" 2>&1 | head -80
|
|
|
|
- name: Test POST with inline data
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
run: |
|
|
echo "=== POST with -d inline ==="
|
|
curl -v --http1.1 -X POST \
|
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"tag_name":"debug-test2","name":"debug-test2"}' \
|
|
"https://git.dungeon.red/api/v1/repos/${{ github.repository }}/releases" 2>&1 | head -80
|
|
|
|
- name: Test with --trace
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
run: |
|
|
echo "=== curl --trace (raw bytes) ==="
|
|
curl --trace /tmp/trace.txt --http1.1 -X POST \
|
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"tag_name":"debug-test3","name":"debug-test3"}' \
|
|
"https://git.dungeon.red/api/v1/repos/${{ github.repository }}/releases" 2>&1 || true
|
|
echo "=== trace output ==="
|
|
cat /tmp/trace.txt | head -100
|
|
|
|
- name: Test wget POST
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
run: |
|
|
echo "=== wget POST ==="
|
|
wget -O- -S --header="Authorization: token ${FORGEJO_TOKEN}" \
|
|
--header="Content-Type: application/json" \
|
|
--post-data='{"tag_name":"debug-test4","name":"debug-test4"}' \
|
|
"https://git.dungeon.red/api/v1/repos/${{ github.repository }}/releases" 2>&1 | head -60 || true
|