- Notifications
You must be signed in to change notification settings - Fork4
An (unofficial) Github command line client (based on Api V3)![]()
License
fulll/github
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This command line client is based on Github API V3.
You can manipulate following Github resources:
Managing resources like pull requests, issues or repositories life cycle andsettings for example.
Some very good tools likehub orterraform providerare already great at doing that.
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 replacelinux by eitherwindows ordarwin)
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
The goal is to have a convenient, lightweight tool to use inside githubactions v2 workflows.
Some use cases that motivated the creation of this tool were:
name:trigger staging deployment on pull request mergedon:push:branches:[master, dev]jobs:deploy:runs-on:ubuntu-lateststeps: -run:echo build app -run:curl -qs https://raw.githubusercontent.com/fulll/github/master/install.sh | bash - -id:deploymentenv: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
name:create production deployment on release publishedon:releasejobs:is-published:runs-on:ubuntu-lateststeps: -if:github.event.action != 'published'run:exit 1build:runs-on:ubuntu-latestneeds:is-publishedsteps: -run:echo build appcreate-deployment:runs-on:ubuntu-latestneeds:buildsteps:# # 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:deploymentenv: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 toin_progressand you effectively deploy on production 🎉
name:deploy on productionon:deployment_statusjobs:should-deploy:runs-on:ubuntu-lateststeps: -if:github.event.deployment.original_environment != 'production' || github.event.deployment_status.state != 'in_progress'run:exit 1deploy:needs:should-deployruns-on:ubuntu-lateststeps: -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)![]()
Topics
Resources
License
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.