Auth
Personal Access Token (PAT)
curl -Lsf \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user
GITHUB_TOKEN
- Auto-provisioned inside a GitHub Actions job
- Scoped to the repository that triggered the workflow
- Expires when the job finishes
# .github/workflows/example.yaml
jobs:
api-call:
runs-on: ubuntu-latest
steps:
- name: Call GitHub API
run: |
curl -Lsf \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues