Giter Club home page Giter Club logo

github-cli-on-gitpod's Introduction

What is GitHub CLI?

It is GitHub’s official command line tool. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.

So, Recently GitHub CLI made a new update to Run Your GitHub Workflow Files through Command Line.

What is GitPod?

Gitpod is an open-source Kubernetes application for ready-to-code developer environments that spins up fresh, automated dev environments for each task, in the cloud, in seconds. It enables you to describe your dev environment as code and start instant, remote and cloud-based developer environments directly from your browser or your Desktop IDE.

Open Your GitHub Repository in Gitpod:

just add this prefix following to your github repository: https://gitpod.io/#

Example: https://gitpod.io/#https://github.com/GITHUB_USERNAME/REPOSITORY_NAME/

GitHub CLI Setup at Gitpod (official docs):

Run Following Commands:

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
sudo apt update
sudo apt install gh

Output:

Installation of GitHub CLI on Gitpod

Setting up the Workflow:

  • Create a empty file under .github/workflows/ named as github-action-demo.yml

  • File Content:

    name: Demo
    
    on:
    # Triggers the workflow on push or pull request events but only for the main branch
    pull_request:
        branches: [main]
    
    # Allows you to run this workflow manually from the Actions tab
    workflow_dispatch:
    
    jobs:
    cli-gitpod:
        name: CLI and Gitpod Demo
        runs-on: ubuntu-latest
        steps:
        - name: Hello From Gitpod
            run: |
            echo "Hello! From Gitpod 🍊"

Login with gh cli

  • Run:

    gh auth login
  • Complete whole step and login.

Test & Run GitHub Workflow with gh cli:

  • To View the list of your workflows:

    gh workflow list

you Will not see anything, because you first have to enbale that workflow.

  • To Enable the workflow:

    gh workflow enable

Workflow Enabled

  • To Run the Workflow:

    gh workflow run demo

Here demo was my workflow name, you can replace it with your workflow's name.

Workflow Run

On GitHub Dashboard:

GitHub Dashboard

  • run history list & analysis:

    gh run list --workflow=github-action-demo.yml

github-action-demo.yml is the filename, replace it with your workflow's filename.

Run List

  • Specific Result of any run ID:

    gh run view 1703727006

1703727006 is ID, replace it with your workflow run ID.

Github workflow run view


Similarly, You Can Run all GitHub CLI Commands in GitPod (gh cli commands)


Contribute in the browser using Gitpod

github-cli-on-gitpod's People

Contributors

siddhant-k-code avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.