GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - fulll/github: An (unofficial) Github command line client (based on Api V3) :octocat:

BranchesTags
Open more actions menu

Latest commit

 

History

47 Commits
47 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
cmd
cmd
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
install-hub.sh
install-hub.sh
 
 
install-local.sh
install-local.sh
 
 
install.sh
install.sh
 
 
main.go
main.go
 
 
main_test.go
main_test.go
 
 
security.md
security.md
 
 

Repository files navigation

An (unofficial) Github command line client

Go Report Card

This command line client is based on Github API V3.

What it does

You can manipulate following Github resources:

  • deployments
  • deployment_status

What it will (probably) never do

Managing resources like pull requests, issues or repositories life cycle and settings for example.

Some very good tools like hub or terraform provider are already great at doing that.

How to install it?

go get github.com/fulll/github

or you can use the install script:

curl -qs https://raw.githubusercontent.com/fulll/github/master/install.sh | bash -

or a simplified version (feel free to replace linux by either windows or darwin)

curl -s https://api.github.com/repos/fulll/github/releases/latest |
jq -r '.assets[] | select(.name | test("linux-amd64$")) | .browser_download_url' |
wget -qi - -O github && chmod +x github

Why another Github client?

The goal is to have a convenient, lightweight tool to use inside github actions v2 workflows.

Some use cases that motivated the creation of this tool were:

How it can help you in github actions v2?

Continuous deployment on staging

name: trigger staging deployment on pull request merged
on:
  push:
    branches: [master, dev]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - run: echo build app
      - run: curl -qs https://raw.githubusercontent.com/fulll/github/master/install.sh | bash -
      - id: deployment
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          id=$(github deployment create --productionEnvironment=false --environment staging $GITHUB_REF)
          github deployment_status create $id in_progress
          echo "##[set-output name=deployment_id;]$id"
      - env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ID: ${{ steps.deployment.outputs.deployment_id }}
        run: |
          echo deploy app
          github deployment_status create $ID success
      - if: failure()
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ID: ${{ steps.deployment.outputs.deployment_id }}
        run: github deployment_status create $ID failure

Continuous delivery on production

name: create production deployment on release published
on: release
jobs:
  is-published:
    runs-on: ubuntu-latest
    steps:
      - if: github.event.action != 'published'
        run: exit 1
  build:
    runs-on: ubuntu-latest
    needs: is-published
    steps:
      - run: echo build app
  create-deployment:
    runs-on: ubuntu-latest
    needs: build
    steps:
      # # optional: install hub
      # - run: |
      #     curl -s https://api.github.com/repos/github/hub/releases/latest |
      #     jq -r '.assets[] | select(.name | contains("linux-amd64")) | .browser_download_url' |
      #     wget -qi - -O - | sudo tar xzpf - -C / --strip-components=1
      # - uses: actions/checkout@master
      - run: curl -qs https://raw.githubusercontent.com/fulll/github/master/install.sh | bash -
      - id: deployment
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          id=$(github deployment create $GITHUB_REF)
          echo "##[set-output name=deployment_id;]$id"
      # #-----------------------------8<----------------------------------------
      # # here: some job(s) to add for example a deploy button/process
      # - uses: some-deploy-button-action
      #   id: button
      #   with:
      #     deployment_id: ${{ steps.deployment.outputs.deployment_id }}
      # - name: append button to release note
      #   env:
      #     DEPLOY_BUTTON: ${{ steps.button.outputs.release-button }}
      #     TAG_NAME: ${{ github.event.release.tag_name }}
      #     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      #     GITHUB_USER: ${{ github.actor }}
      #   run: |
      #     button=$(printf '\n## Deploy to production :rocket:\n%s\n' "$DEPLOY_BUTTON")
      #     hub release edit -m "" -m "$(hub release show $TAG_NAME -f %b)" -m "$button" $TAG_NAME
      # #-----------------------------8<----------------------------------------

Then, some external approbation process put the deployment status to in_progress and you effectively deploy on production 🎉

name: deploy on production
on: deployment_status
jobs:
  should-deploy:
    runs-on: ubuntu-latest
    steps:
      - if: github.event.deployment.original_environment != 'production' || github.event.deployment_status.state != 'in_progress'
        run: exit 1
  deploy:
    needs: should-deploy
    runs-on: ubuntu-latest
    steps:
      - run: curl -qs https://raw.githubusercontent.com/fulll/github/master/install.sh | bash -
      - env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ID: ${{ github.event.deployment.id }}
        run: |
          echo deploy app
          github deployment_status create $ID success
      - if: failure()
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ID: ${{ github.event.deployment.id }}
        run: github deployment_status create $ID failure

About

An (unofficial) Github command line client (based on Api V3) :octocat:

Topics

cdclicontinuous-deliverycontinuous-deploymentgithubgithub-actionsgithub-apigithub-api-v3gogolangunofficial

Resources

Readme
MIT license

Security policy

Security policy
Activity
Custom properties

Stars

10 stars

Watchers

14 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.