actions4gh / setup-gh

👨‍💻 Install & configure the GitHub CLI (gh) in your GitHub Actions runner
MIT License
5 stars 1 forks source link
gh github-action github-actions github-cli installer setup

Setup the GitHub CLI

👨‍💻 Install & configure the GitHub CLI (gh) in your GitHub Actions runner

```yml - uses: actions4gh/setup-gh@v1 - run: gh issue create --body "$BODY" env: GH_REPO: ${{ github.repository }} BODY: Hello world! ```

👩‍💻 Installs any version of the GitHub CLI you want \ 🏃‍♂️ Works with self-hosted runners \ 🐳 Works great in container-based jobs

Usage

GitHub Actions GitHub

⚠️ This action is only useful if your runner doesn't already come with gh. The default GitHub Actions hosted runners come with gh installed. You only need this action to install gh if you're using a Docker container for a job or if you're using a self-hosted runner image that doesn't come with gh installed.

Here's an example of a container scenario where you might need to use this action:

name: Test
on:
  push:
    branches: "main"
jobs:
  test-alpine:
    permissions:
      issues: write
    runs-on: ubuntu-latest
    container: alpine:latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions4gh/setup-gh@v1
      - run: gh issue create --body "$BODY"
        env:
          BODY: Hello world!

Inputs

Outputs

Development

Node.js

How do I test my changes?

Open a Draft Pull Request and some magic GitHub Actions will run to test the action.