Skip to content

Traffic workflow

Traffic workflow #13

Workflow file for this run

name: Traffic
on: workflow_dispatch
jobs:
fetch_traffic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fetch views data
run: |
response=$(curl --write-out '%{http_code}' --request GET \
--url https://api.github.com/repos/${{ github.repository }}/traffic/views \
--header 'authorization: Bearer ${{ secrets.TRAFFIC_API }}' \
--header 'content-type: application/json')
if [ "$response" = "200" ]; then
curl --request GET \
--url https://api.github.com/repos/${{ github.repository }}/traffic/views \
--header 'authorization: Bearer ${{ secrets.TRAFFIC_API }}' \
--header 'content-type: application/json' >> $GITHUB_WORKSPACE/traffic/views.json
else
echo "Failed to fetch traffic data. HTTP status code: $response"
exit 1
fi