You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
GitHub API Request
v1.0.2
A GitHub Action to send arbitrary requests to GitHub's REST API
Minimal example
Name: Log latest release
on:
push:
branches:
- master
jobs:
update_routes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/:owner/:repo/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "echo latest release: ${{ steps.get_latest_release.outputs.data }}"
To see additional debug logs, create a secret with the name: ACTIONS_STEP_DEBUG
and value true
.
octokit/request-action
is using @octokit/request
internally with some additions
- Requests are authenticated using the
GITHUB_TOKEN
environment variable. It is required to prevent rate limiting, as all anonymous requsets from the same origin count against the same low rate. - The
owner
andrepo
parameters are preset to the repository that the action is run in.
The actions sets data
output to the response data. Note that it is a string, you cannot access any keys of the response at this point. The action also sets headers
(again, to a JSON string) and status
.