Skip to content

Latest commit

 

History

History
54 lines (46 loc) · 1.85 KB

README.md

File metadata and controls

54 lines (46 loc) · 1.85 KB

setup-gh

This action sets up GitHub Cli (gh) into the CI environment.

This is normally not required as GitHub's hosted runner image already includes it, but will become handy if you use a customer container. However, as custom containers are only allowed on linux runners, this action will only attempt an install on linux (given if its not in path).

Beside ensuring GitHub Cli is installed, this action also sets up the environment for the CLI to operate. Mainly, setting GH_TOKEN and GH_REPO environment variables with appropriate values.

Example usage

name: Create Issue
on: push
jobs:
  test:
    name: Create Issue
    runs-on: ubuntu-latest
    # This image will be pulled from docker, 
    # therefore, it will (likely) not include gh
    container: ubuntu:latest
    steps:
      - name: Setup gh
        uses: wusatosi/setup-gh@v1

      - name: Open issue
        run: gh issue create --title "I found a bug" --body "Nothing works"

Inputs

Token:

This value sets GH_TOKEN environment variable, which defaults to ${{ github.token }}. This is the access control token passed to Cli.

- name: Setup gh
  uses: wusatosi/setup-gh@v1
  with:
    token: ghp_xxxxxxxxxxxxx

Repository:

This value sets GH_REPO environment variable, which defaults to ${{ github.repository }} (the repository of the triggered workflow). This is the repository the Cli will operate over.

- name: Setup gh
  uses: wusatosi/setup-gh@v1
  with:
    repository: wusatosi/Test