GithubHelp home page GithubHelp logo

githubapi's Introduction

GitHub API

Overview

Sample for GitHub OAuth API.

Pre-requisites

  • Create Github account

  • Create a repository which is supposed to be handled by this application.

    • Create repository.

    • Make main branch name as "main".

    • Add, commit, and push at least one file into this main branch.

  • If you want to make this repository to be used by another GitHub user, you need to add him/her as Collaborator in this repository.

Setup

  • Sign-in to GitHub : https://github.com/

  • Navigate from upper-right menu: Settings - Developer settings - OAuth Apps - New GitHub App

  • Input App name, Homepage URL(http://localhost:8080 for example), Callback URL(http://localhost:8080/api/callback for example), and click Create GitHub App button.

  • Copy client_id, (generated)client_secret, and callback_url, then paste them into settings.js.

  • Edit repo_name in settings.js. This value is supposed to be a same name of repository which is created in above.

    • If your Github username is USER and repository name is REPO, then this value should be set as USER/REPO.
  • Edit target_branch_name in settings.js, if needed. This value is a branch name of repository which is supposed to be created in initial setup and to be merged into.

How to run

  • Install Node.js

  • Git clone or Download this code:

    • $ git clone https://github.com/dotnsf/githubapi

    • $ cd githubapi

  • Install dependant libraries:

    • $ npm install
  • Run application:

    • $ node app
  • Browse application with web browser:

GitHub OAuth API References

https://docs.github.com/en/developers/apps/building-oauth-apps

GitHub REST API References

https://docs.github.com/en/rest

References

https://qiita.com/ngs/items/34e51186a485c705ffdb

Licensing

This code islicensed under MIT.

Copyright

2021 K.Kimura @ Juge.Me all rights reserved.

githubapi's People

Contributors

dotnsf avatar

Stargazers

akio tanaka avatar Neos21 avatar

Watchers

James Cloos avatar  avatar

githubapi's Issues

有効な SHA の管理方法

現在は(処理効率を考慮した結果として)セッション内で管理している。

セッションなしでも動くようにするべきか? その場合は常に有効な SHA を取得してからメイン処理を行うよう変更する必要がある。

一方でセッションなしで動かすには SHA 以外の管理要素のことも考慮しないといけない(アクセストークンや GitHub ID など)。すべてに対応するのは非現実的でもある。今のままでも支障があるわけではない。

マージボタンは不要

ユーザーの操作でマージさせるのは不都合(main ブランチは README.md 1つのままでよい、そうでないと他の人がマージした状態の main からブランチができてしまう)。

あるいはチェックアウト元専用のブランチを1つ作る? 作らせる必要があるのだとしたら面倒。

マージ先専用ブランチでもいいが・・・面倒なのは同じこと。

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.