All Projects → octokit → Request Action

octokit / Request Action

Licence: mit
A GitHub Action to send arbitrary requests to GitHub's REST API

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Request Action

Chocobar
The usual Snackbar with more 🍫 and colours 🎉
Stars: ✭ 110 (+0%)
Mutual labels:  hacktoberfest
Scaffold Static
Scaffolding utility for vanilla-js
Stars: ✭ 111 (+0.91%)
Mutual labels:  hacktoberfest
Vscode Mermaid Preview
Previews Mermaid diagrams
Stars: ✭ 111 (+0.91%)
Mutual labels:  hacktoberfest
Foreman Ansible Modules
Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
Stars: ✭ 109 (-0.91%)
Mutual labels:  hacktoberfest
Spotify Playlist Archive
Daily snapshots of public Spotify playlists
Stars: ✭ 111 (+0.91%)
Mutual labels:  hacktoberfest
React Figma
⚛️ A React renderer for Figma
Stars: ✭ 1,830 (+1563.64%)
Mutual labels:  hacktoberfest
Action policy Graphql
Action Policy integration for GraphQL
Stars: ✭ 110 (+0%)
Mutual labels:  hacktoberfest
Nyxo App
The repository for Nyxo React Native app, a personal sleep tracker and sleep coach
Stars: ✭ 111 (+0.91%)
Mutual labels:  hacktoberfest
Presently
Android app for recording gratitude journal entries
Stars: ✭ 109 (-0.91%)
Mutual labels:  hacktoberfest
Viewers
The OHIF Medical Imaging Viewer is for viewing medical images. It can retrieve and load images from most sources and formats; render sets in 2D, 3D, and reconstructed representations; allows for the manipulation, annotation, and serialization of observations; supports internationalization, OpenID Connect, offline use, hotkeys, and many more features.
Stars: ✭ 1,753 (+1493.64%)
Mutual labels:  hacktoberfest
Nodejs.dev
A new Node.js resource built using Gatsby.js with React.js, TypeScript, and Remark.
Stars: ✭ 1,794 (+1530.91%)
Mutual labels:  hacktoberfest
Omegaup
omegaUp automatic programming contest evaluator & arena
Stars: ✭ 110 (+0%)
Mutual labels:  hacktoberfest
Floki
Floki is a simple HTML parser that enables search for nodes using CSS selectors.
Stars: ✭ 1,642 (+1392.73%)
Mutual labels:  hacktoberfest
Belajar Git
Tutorial Git dalam Bahasa Indonesia
Stars: ✭ 109 (-0.91%)
Mutual labels:  hacktoberfest
Panoramagl
PanoramaGL Android
Stars: ✭ 111 (+0.91%)
Mutual labels:  hacktoberfest
Fuego
Fuego is a command line client for the firestore database (https://firebase.google.com/docs/firestore).
Stars: ✭ 110 (+0%)
Mutual labels:  hacktoberfest
Vscode abap remote fs
Remote filesystem for ABAP systems
Stars: ✭ 111 (+0.91%)
Mutual labels:  hacktoberfest
Default
The home of the default HACS repositories.
Stars: ✭ 110 (+0%)
Mutual labels:  hacktoberfest
Make Pull Request
Use this as learning repo on how to create successful pull requests. Very basic tasks on Python, HTML, CSS, JavaScript, JAVA.
Stars: ✭ 112 (+1.82%)
Mutual labels:  hacktoberfest
Emacs Doom Themes
A megapack of themes for GNU Emacs.
Stars: ✭ 1,706 (+1450.91%)
Mutual labels:  hacktoberfest

Octokit Request Action

A GitHub Action to send arbitrary requests to GitHub's REST API

Build Status

Usage

Minimal example

name: Log latest release
on:
  push:
    branches:
      - master

jobs:
  logLatestRelease:
    runs-on: ubuntu-latest
    steps:
      - uses: octokit/[email protected]
        id: get_latest_release
        with:
          route: GET /repos/{owner}/{repo}/releases/latest
          owner: octokit
          repo: request-action
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - run: "echo latest release: ${{ steps.get_latest_release.outputs.data }}"

More complex examples involving POST, setting custom media types, and parsing output data

name: Check run
on:
  push:
    branches:
      - master

jobs:
  create-file:
    runs-on: ubuntu-latest
    steps:
      # Create check run
      - uses: octokit/[email protected]
        id: create_check_run
        with:
          route: POST /repos/{owner}/{repo}/check-runs
          owner: octokit
          repo: request-action
          name: "Test check run"
          head_sha: ${{ github.sha }}
          output: | # The | is significant!
            title: Test check run title
            summary: A summary of the test check run
            images:
              - alt: Test image
                image_url: https://octodex.github.com/images/jetpacktocat.png
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      # Update check run to completed, successful status
      - uses: octokit/[email protected]
        id: update_check_run
        with:
          route: PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}
          owner: octokit
          repo: request-action
          check_run_id: ${{ fromJson(steps.create_check_run.outputs.data).id }}
          conclusion: "success"
          status: "completed"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inputs

To use request body parameters, simply pass in an input matching the parameter name. See previous examples.

Due to how request parameters are processed, it may be necessary in some cases to first encode the value as either JSON or a block scalar:

env:
  REQUEST_BODY: |
    Multi-line string with *special* characters:
    - "'`
with:
  # As JSON
  body: ${{ toJSON(env.REQUEST_BODY) }}
  
  # As block scalar
  body: |
    |
    ${{ env.REQUEST_BODY }}

Debugging

To see additional debug logs, create a secret with the name: ACTIONS_STEP_DEBUG and value true.

How it works

octokit/request-action is using @octokit/request internally with the addition that requests are automatically authenticated using the GITHUB_TOKEN environment variable. It is required to prevent rate limiting, as all anonymous requests from the same origin count against the same low rate.

The actions sets data output to the response data. The action also sets the headers (again, to a JSON string) and status output properties.

To access deep values of outputs.data and outputs.headers, check out the fromJson function.

Warnings

The GitHub Actions runners are currently showing warnings when using this action that look like:

##[warning]Unexpected input 'repository', valid inputs are ['route', 'mediaType']

The reason for this warning is because the repository key is not listed as a possible value in actions.yml. This warning will appear for any key used under the with except route and mediaType. Due to the flexible nature of the required inputs depending on the route, not all of the possible paramters can be listed in actions.yml, so you will see this warning under normal usage of the action. As long as you see a 200 response code at the bottom of the output, everything should have worked properly and you can ignore the warnings. The response code will appear at the bottom of the output from the action and looks like:

< 200 451ms

See Issue #26 for more information.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].