技術関連記事
Git開発事業

各GitのWebhook連携を行う、GitLabとGitHubのnpmライブラリを使用して必要なプロジェクト情報を取得する

今回案件にてnpmライブラリを使用しgitlabとgithubのリポジトリ情報を取得する実装、そのための前提としてgitlabとgithubのwebhook連携を用いてリポジトリ情報をクローン、プルする実装を行ったので記事としてまとめます。

目次

前段

案件にて改修しているアプリケーションで、OAS(OpenAPI Spec)をgitLabからWebhookで連携し、
OASに変更があったら自動的にプルして反映させるという機能が存在します。
それを今回githubにも対応させるという実装を行ったので、実装までの流れを説明します。
また、gitのプロジェクト情報を取得の前提としてwebhook連携を行う必要があったため各gitのwebhook手順についても記載します。
本案件ではNode.jsを使用しているのでnpm(Node Package Manager)ライブラリを利用しプロジェクト情報を取得しています。

■キーワードについて
▶npm
→npm とはNode.jsのパッケージを管理するシステム、所謂パッケージ管理システムのことです。

▶git / gitlab / github
→gitはファイルのバージョン管理を簡単に行える仕組み、gitlabとgithubに関しては、どちらもgit機能を使ったソースコード管理サービスとなります。

▶リポジトリ
→リポジトリとはファイルやディレクトリなどの状態を記録する場所のことを指し、保存された内容は、変更履歴として格納されます。
▶Webhookとは?
https://qiita.com/soarflat/items/ed970f6dc59b2ab76169
▶便利なパッケージ管理ツール!npmとは【初心者向け】
https://techacademy.jp/magazine/16105

GitLab編

■webhook連携手順
01
アクセストークンを発行する

webhookを飛ばすためにはアクセストークンが必要になります。
gitlabユーザー設定画面の画面左側メニューからアクセストークン設定画面に移動します。


アクセストークン設定画面の入力項目を記載していき、作成ボタンをクリックします。
Name: どういった用途のアクセストークンなのかわかりやすい名前を決め記載します。
Expires at: アクセストークンの有効期限を記載。未入力で無期限となります。
Scopes: 「api」にチェックを入れます。



発行が完了すると完了画面に遷移します。
発行したアクセストークンは完了画面から移動すると再度確認ができなくなるのでこのタイミングでトークンをコピーしておいてください。



02
webhook設定を行う
webhookを行うgitlabリポジトリを開き、画面左側メニューのsetting内にあるIntegrationsへ遷移。
webhookの設定について項目を記載します。
URL: webhookを行う対象のURLを設定します。
Secret Token: 1.で発行したアクセストークンを記載します。
Trigger: webhookを行うタイミングが決まっていればチェックを入れます。(基本的にはPush eventsがあれば問題ないです。)
Add webhookボタンを押下し、webhookの設定を完了します。


03
仮のリクエストを飛ばすためのcurlコマンドを用意します。
webhook連携でリクエストを送るのだが検証の都度gitlabからwebhookを飛ばすのは手間がかかるため、
手軽にリクエストを飛ばすにはcurlコマンドを入力します。

参考:curlコマンドでちょこっとHTTPリクエストを試すだけの記事
https://qiita.com/akane_kato/items/34b408336f4ec372b139

先ほど作成したwebookがwebhook設定画面下部に一覧表示されるのでそこからTest→[webhookを飛ばすチェックを入れたタイミング]を押します。



webhookを飛ばした履歴が表示されるのでview detailsをクリックします。


実際に送ったリクエスト内容が表示されるのでこのRequest bodyを利用しcurlコマンドを作成をします。



下記が作成したcurlコマンドの例となります。
X-Gitlab-Token: 1.で発行したアクセストークンを記載。
-d: ここへRequest bodyをコピー&ペーストします。


curl -sS 'localhost:0000' -XPOST -H 'Content-Type: application/json' -H 'X-Gitlab-Event: Push Hook' -H 'X-Gitlab-Token: xxxxxxxxxxxxxxxxxxxxxxx' -d '{ "object_kind": "push", "event_name": "push", "before": "a926865fcadd0beba74dfd1f368ce10ad168886b", "after": "d5667aaabf8a8607b99b0f5f7eb96b656818dfeb", "ref": "refs/heads/master", "checkout_sha": "d5667aaabf8a8607b99b0f5f7eb96b656818dfeb", "message": null, "user_id": 1, "user_name": "Administrator", "user_username": "root", "user_email": "", "user_avatar": "", "project_id": 0, "project": { "id": 0, "name": "hoge", "description": "hoge", "web_url": "", "avatar_url": null, "git_ssh_url": "git@192.168.86.250:root/hoge.git", "git_http_url": "", "namespace": "hogehoge", "visibility_level": 0, "path_with_namespace": "root/hoge", "default_branch": "master", "ci_config_path": null, "homepage": "", "url": "git@192.168.86.250:root/hoge.git", "ssh_url": "git@192.168.86.250:root/hoge.git", "http_url": "" }, "commits": [ { "id": "d5667aaabf8a8607b99b0f5f7eb96b656818dfeb", "message": "Replace spots.jpg", "timestamp": "2021-08-02T06:10:15Z", "url": "", "author": { "name": "hogehoge", "email": "admin@example.com" }, "added": [ ], "modified": [ "spots/spots.jpg" ], "removed": [ ] }, { "id": "d0a1cfa67d22101ccbc42ca15b7a569614aa15d5", "message": "Merge branch 'master' of ", "timestamp": "2021-07-30T05:28:56Z", "url": "", "author": { "name": "hogehoge", "email": "hoge@hoge.com" }, "added": [ ], "modified": [ "pet-store/openapi.yaml" ], "removed": [ ] }, { "id": "a926865fcadd0beba74dfd1f368ce10ad168886b", "message": "oas file rename\\n", "timestamp": "2021-07-30T05:28:27Z", "url": "", "author": { "name": "hogehoge", "email": "hoge@hoge.com" }, "added": [ "oas/openapi.yaml" ], "modified": [ ], "removed": [ ] } ], "total_commits_count": 3, "push_options": { }, "repository": { "name": "hoge", "url": "git@192.168.86.250:root/hoge.git", "description": "", "homepage": "", "git_http_url": "", "git_ssh_url": "git@192.168.86.250:root/hoge.git", "visibility_level": 0 }}'

ここで作成したcurlコマンドを任意のshellで叩くとリクエストが飛ばされます。

■npmライブラリ用いてGitLabのリポジトリ情報を取得する。

01
npmライブラリをインストール
下記ライブラリをインストールします。

@gitbeaker/core
https://www.npmjs.com/package/@gitbeaker/core

02
APIクライアントを作成
APIクライアントを作成しgitbeakerライブラリにアクセスできるようにします。


import { Gitlab } from "@gitbeaker/node";
・
・
・
let gitlab_api = new Gitlab({
                    host: this.GITLAB_HOST,
                    token: this.GITLAB_ACCESS_TOKEN,
                });


hostにはアクセスするgitlabのホスト名を入力します。(例: "https://gitlab.com")
tokenには上記で発行したアクセストークンを入力します。

03
リポジトリ情報を取得

上記変数gitlab_apiの中でAPIクライアントを作成したのでgitbeakerライブラリの様々なAPIを参照できるようになりました。
参照可能なAPIは下記githubに挙がっています。
参照可能なAPI一覧
https://github.com/jdalrymple/gitbeaker/tree/0d53e51bc83f57e0451100fde69423cb3b7bef59/packages/core/src/resources

今回使用したのはライブラリ内Projectsのshowというファンクションで、gitlab連携に必要なリポジトリ情報を取得することが可能です。
引数にはcurlコマンドを叩いた際のリクエストヘッダ内になるproject_idを渡すことにより、そのgitlabのプロジェクトIDに紐づいたリポジトリ情報が取得できます。


```
return await this.gitlab_api.Projects.show(projectId);
```

```
// console.log
{
  id: 5,
  description: '',
  name: 'hoge',
  name_with_namespace: 'Administrator / hoge',
  path: 'hoge',
  path_with_namespace: 'root/hoge',
  created_at: '2021-07-19T10:09:03.235Z',
  default_branch: 'master',
  tag_list: [],
  ssh_url_to_repo: 'git@192.168.86.250:root/hoge.git',
  http_url_to_repo: 'http://192.168.86.250:9001/root/hoge.git',
  web_url: 'http://192.168.86.250:9001/root/hoge',
  readme_url: null,
  avatar_url: null,
  star_count: 0,
  forks_count: 0,
  last_activity_at: '2022-03-23T09:30:22.381Z',
  namespace: {
    id: 1,
    name: 'Administrator',
    path: 'root',
    kind: 'user',
    full_path: 'root',
    parent_id: null,
    avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
    web_url: 'http://192.168.86.250:9001/root'
  },
  _links: {
    self: 'http://192.168.86.250:9001/api/v4/projects/5',
    issues: 'http://192.168.86.250:9001/api/v4/projects/5/issues',
    merge_requests: 'http://192.168.86.250:9001/api/v4/projects/5/merge_requests',
    repo_branches: 'http://192.168.86.250:9001/api/v4/projects/5/repository/branches',
    labels: 'http://192.168.86.250:9001/api/v4/projects/5/labels',
    events: 'http://192.168.86.250:9001/api/v4/projects/5/events',
    members: 'http://192.168.86.250:9001/api/v4/projects/5/members'
  },
  empty_repo: false,
  archived: false,
  visibility: 'private',
  owner: {
    id: 1,
    name: 'Administrator',
    username: 'root',
    state: 'active',
    avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
    web_url: 'http://192.168.86.250:9001/root'
  },
  resolve_outdated_diff_discussions: false,
  container_registry_enabled: true,
  issues_enabled: true,
  merge_requests_enabled: true,
  wiki_enabled: true,
  jobs_enabled: true,
  snippets_enabled: true,
  issues_access_level: 'enabled',
  repository_access_level: 'enabled',
  merge_requests_access_level: 'enabled',
  wiki_access_level: 'enabled',
  builds_access_level: 'enabled',
  snippets_access_level: 'enabled',
  shared_runners_enabled: true,
  lfs_enabled: true,
  creator_id: 1,
  import_status: 'none',
  import_error: null,
  open_issues_count: 0,
  runners_token: 'KQMVuEp2y2sdAh6cT1rx',
  ci_default_git_depth: 50,
  public_jobs: true,
  build_git_strategy: 'fetch',
  build_timeout: 3600,
  auto_cancel_pending_pipelines: 'enabled',
  build_coverage_regex: null,
  ci_config_path: null,
  shared_with_groups: [],
  only_allow_merge_if_pipeline_succeeds: false,
  request_access_enabled: false,
  only_allow_merge_if_all_discussions_are_resolved: false,
  printing_merge_request_link_enabled: true,
  merge_method: 'merge',
  auto_devops_enabled: false,
  auto_devops_deploy_strategy: 'continuous',
  permissions: {
    project_access: { access_level: 40, notification_level: 3 },
    group_access: null
  }
} project
```

今回使用したProjectsAPIファイル
https://github.com/jdalrymple/gitbeaker/blob/0d53e51bc83f57e0451100fde69423cb3b7bef59/packages/core/src/resources/Projects.ts


GitHub編

■webhook手順

01
アクセストークンを発行する
webhookを飛ばすためにはアクセストークンが必要になる。githubユーザー設定画面に移動する。
画面左部メニューの Developer Settingをクリックし設定画面を表示します。

Personal access tokensをクリックしアクセストークン画面を表示し、Generate new tokenでアクセストークン発行画面に移動します。



項目を入力後Generate tokenを押下しトークン作成を完了します。
Note: どういった用途のアクセストークンなのかわかりやすい名前を決め記載してください。
Expiration: アクセストークンの有効期限を記載する。デフォルトは30日間となっております。
Select scopes: 「repo」「repo_hook」にチェックを入れてください。



発行が完了すると完了画面に遷移する。発行したアクセストークンは完了画面から移動すると再度確認ができなくなるのでこのタイミングでトークンをコピーしておいてください。



02
webhook設定を行う
webhookを行うgithubリポジトリを開き、setting画面左側メニュー内にあるWebhooksをクリック。
Add webhookボタンをクリックし入力画面に進んでください。



webhookの設定について項目を記載。
Payload URL: webhookを行う対象のURLを設定します。
Secret: 1.で発行したアクセストークンを記載してください
Add webhookボタンを押下し、webhookの設定を完了します。



03
仮のリクエストを飛ばすためのcurlコマンドを用意します。

webhook連携でリクエストを送るのだが検証の都度githubからwebhookを飛ばすのは手間がかかるため、手軽にリクエストを飛ばすにはcurlコマンドを入力します。
先ほど作成したwebookの編集画面へ移動しRecent Deliveriesタブをクリック
webhookを飛ばした履歴が表示されるのでクリックします。
実際に送ったリクエスト内容が表示されるのでこのPayloadを利用しcurlコマンドを作成してください。



下記が作成したcurlコマンドの例となります。
-d: ここへPayloadをコピー&ペーストします。

```
curl -sS 'localhost:0000/hoge' -XPOST -H 'Content-Type: application/json' -d '{  "zen": "Keep it logically awesome.",  "hook_id": 350817432,  "hook": {    "type": "Repository",    "id": 350817432,    "name": "web",    "active": true,    "events": [      "push"    ],    "config": {      "content_type": "json",      "insecure_ssl": "0",      "url": "https://hoge/hoge"    },    "updated_at": "2022-03-31T08:11:12Z",    "created_at": "2022-03-31T08:11:12Z",    "url": "https://api.github.com/repos/hoge",    "test_url": "https://api.github.com/repos/hoge/test",    "ping_url": "https://api.github.com/repos/hoge/pings",    "deliveries_url": "https://api.github.com/repos/hoge/deliveries",    "last_response": {      "code": null,      "status": "unused",      "message": null    }  },  "repository": {    "id": 319613524,    "node_id": "MDEwOlJlcG9zaXRvcnkzMTk2MTM1MjQ=",    "name": "hoge",    "full_name": "hoge/hoge",    "private": false,    "owner": {      "login": "hogehoge",      "id": 74447457,      "node_id": "hogehoge",      "avatar_url": "https://hoge/hoge",      "gravatar_id": "",      "url": "https://api.github.com/users/hoge",      "html_url": "https://github.com/hoge",      "followers_url": "https://api.github.com/users/hoge/followers",      "following_url": "https://api.github.com/users/hoge/following{/other_user}",      "gists_url": "https://api.github.com/users/hoge/gists{/gist_id}",      "starred_url": "https://api.github.com/users/hoge/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/hoge/subscriptions",      "organizations_url": "https://api.github.com/users/hoge/orgs",      "repos_url": "https://api.github.com/users/hoge/repos",      "events_url": "https://api.github.com/users/hoge/events{/privacy}",      "received_events_url": "https://api.github.com/users/hoge/received_events",      "type": "User",      "site_admin": false    },    "html_url": "https://github.com/hoge/hoge",    "description": "",    "fork": false,    "url": "https://api.github.com/repos/hoge",    "forks_url": "https://api.github.com/repos/hoge/forks",    "keys_url": "https://api.github.com/repos/hoge/keys{/key_id}",    "collaborators_url": "https://api.github.com/repos/hoge/collaborators{/collaborator}",    "teams_url": "https://api.github.com/repos/hoge/teams",    "hooks_url": "https://api.github.com/repos/hoge/hooks",    "issue_events_url": "https://api.github.com/repos/hoge/issues/events{/number}",    "events_url": "https://api.github.com/repos/hoge/events",    "assignees_url": "https://api.github.com/repos/hoge/assignees{/user}",    "branches_url": "https://api.github.com/repos/hoge/branches{/branch}",    "tags_url": "https://api.github.com/repos/hoge/tags",    "blobs_url": "https://api.github.com/repos/hoge/git/blobs{/sha}",    "git_tags_url": "https://api.github.com/repos/hoge/git/tags{/sha}",    "git_refs_url": "https://api.github.com/repos/hoge/git/refs{/sha}",    "trees_url": "https://api.github.com/repos/hoge/git/trees{/sha}",    "statuses_url": "https://api.github.com/repos/hoge/statuses/{sha}",    "languages_url": "https://api.github.com/repos/hoge/languages",    "stargazers_url": "https://api.github.com/repos/hoge/stargazers",    "contributors_url": "https://api.github.com/repos/hoge/contributors",    "subscribers_url": "https://api.github.com/repos/hoge/subscribers",    "subscription_url": "https://api.github.com/repos/hoge/subscription",    "commits_url": "https://api.github.com/repos/hoge/commits{/sha}",    "git_commits_url": "https://api.github.com/repos/hoge/git/commits{/sha}",    "comments_url": "https://api.github.com/repos/hoge/comments{/number}",    "issue_comment_url": "https://api.github.com/repos/hoge/issues/comments{/number}",    "contents_url": "https://api.github.com/repos/hoge/contents/{+path}",    "compare_url": "https://api.github.com/repos/hoge/compare/{base}...{head}",    "merges_url": "https://api.github.com/repos/hoge/merges",    "archive_url": "https://api.github.com/repos/hoge/{archive_format}{/ref}",    "downloads_url": "https://api.github.com/repos/hoge/downloads",    "issues_url": "https://api.github.com/repos/hoge/issues{/number}",    "pulls_url": "https://api.github.com/repos/hoge/pulls{/number}",    "milestones_url": "https://api.github.com/repos/hoge/milestones{/number}",    "notifications_url": "https://api.github.com/repos/hoge/notifications{?since,all,participating}",    "labels_url": "https://api.github.com/repos/hoge/labels{/name}",    "releases_url": "https://api.github.com/repos/hoge/releases{/id}",    "deployments_url": "https://api.github.com/repos/hoge/deployments",    "created_at": "2020-12-08T11:09:29Z",    "updated_at": "2022-03-23T09:54:35Z",    "pushed_at": "2022-03-23T09:42:17Z",    "git_url": "git://github.com/hoge.git",    "ssh_url": "git@github.com:hoge.git",    "clone_url": "https://github.com/hoge.git",    "svn_url": "https://github.com/hoge",    "homepage": "",    "size": 134,    "stargazers_count": 0,    "watchers_count": 0,    "language": null,    "has_issues": true,    "has_projects": true,    "has_downloads": true,    "has_wiki": true,    "has_pages": false,    "forks_count": 0,    "mirror_url": null,    "archived": false,    "disabled": false,    "open_issues_count": 0,    "license": null,    "allow_forking": true,    "is_template": false,    "topics": [    ],    "visibility": "public",    "forks": 0,    "open_issues": 0,    "watchers": 0,    "default_branch": "main"  },  "sender": {    "login": "apilabeyes",    "id": 74447457,    "node_id": "hoge",    "avatar_url": "https://avatars.githubusercontent.com/u/74447457?v=4",    "gravatar_id": "",    "url": "https://api.github.com/users/hoge",    "html_url": "https://github.com/hoge",    "followers_url": "https://api.github.com/users/hoge/followers",    "following_url": "https://api.github.com/users/hoge/following{/other_user}",    "gists_url": "https://api.github.com/users/hoge/gists{/gist_id}",    "starred_url": "https://api.github.com/users/hoge/starred{/owner}{/repo}",    "subscriptions_url": "https://api.github.com/users/hoge/subscriptions",    "organizations_url": "https://api.github.com/users/hoge/orgs",    "repos_url": "https://api.github.com/users/hoge/repos",    "events_url": "https://api.github.com/users/hoge/events{/privacy}",    "received_events_url": "https://api.github.com/users/hoge/received_events",    "type": "User",    "site_admin": false  }}'

```

ここで作成したcurlコマンドを任意のshellで叩くとリクエストが飛ばされます。


■npmライブラリ用いてGitHubのリポジトリ情報を取得する
01
npmライブラリをインストール
下記ライブラリをインストールします。
github-api
https://www.npmjs.com/package/github-api

02
APIクライアントを作成
APIクライアントを作成しライブラリにアクセスできるようにします。



```
import GitHub from 'github-api';
・
・
・
let github_api = new GitHub({
                    username: this.GITHUB_USERNAME,
                    password: this.GITHUB_PASSWORD,
                    token: this.GITHUB_ACCESS_TOKEN
                });

```

usernameにはgithubアカウントのユーザー名を入力します。
passwordにはgithubアカウントのパスワードを入力します。
tokenには上記で発行したアクセストークンを入力します。

※ファンクションを利用するにはget関数で使用したいAPIフォルダへアクセスする必要があります。今回はRepositoryファイルのAPIを利用しリポジトリ情報を取得するのでgetRepoでファイルへアクセスをします。引数はリクエストから取得したgithubのfullnameが必要になります。(他にProjectファイルへアクセスするにはgetProject,IssueファイルへアクセスするにはgetIssuesなどが用意されています。get関数はGitHub.jsを参照)


```
let github_repo = this.github_api.getRepo(req.repository.full_name);

```

利用可能なAPIフォルダ
https://github.com/github-tools/github/tree/master/lib

03
リポジトリ情報を取得する
上記変数github_repoの中でRepositoryファイルの関数を使用可能になったので実際にリポジトリ情報を取得していきます。

Repository.js
https://github.com/github-tools/github/blob/master/lib/Repository.js
今回使用したのはライブラリ内Repository.jsのgetDetailsというファンクションで、github連携に必要なリポジトリ情報を取得することが可能です。


```
return await this.github_repo.getDetails();

```

```
// console.log
data: {
id: 319613524,
node_id: 'xxxxxxxxxxxxxx=',
name: 'hoge',
full_name: 'hoge_hoge',
private: false,
owner: {
  login: 'hoge',
  id: xxxxxxxxx,
  node_id: 'xxxxxxxxxxxxx',
  avatar_url: 'https://avatars.githubusercontent.com/u/74447457?v=4',
  gravatar_id: '',
  url: 'https://api.github.com/users/hoge',
  html_url: 'https://github.com/hoge',
  followers_url: 'https://api.github.com/users/hoge/followers',
  following_url: 'https://api.github.com/users/hoge/following{/other_user}',
  gists_url: 'https://api.github.com/users/apilabeyes/gists{/gist_id}',
  starred_url: 'https://api.github.com/users/hoge/starred{/owner}{/repo}',
  subscriptions_url: 'https://api.github.com/users/hoge/subscriptions',
  organizations_url: 'https://api.github.com/users/hoge/orgs',
  repos_url: 'https://api.github.com/users/hoge/repos',
  events_url: 'https://api.github.com/users/hoge/events{/privacy}',
  received_events_url: 'https://api.github.com/users/hoge/received_events',
  type: 'User',
  site_admin: false
},
html_url: 'https://github.com/hoge',
description: '',
fork: false,
url: 'https://api.github.com/repos/hoge',
forks_url: 'https://api.github.com/repos/hoge/forks',
keys_url: 'https://api.github.com/repos/hoge/keys{/key_id}',
collaborators_url: 'https://api.github.com/repos/hoge/collaborators{/collaborator}',
teams_url: 'https://api.github.com/repos/hoge/teams',
hooks_url: 'https://api.github.com/repos/hoge/hooks',
issue_events_url: 'https://api.github.com/repos/hoge/issues/events{/number}',
events_url: 'https://api.github.com/repos/hoge/events',
assignees_url: 'https://api.github.com/repos/hoge/assignees{/user}',
branches_url: 'https://api.github.com/repos/hoge/branches{/branch}',
tags_url: 'https://api.github.com/repos/hoge/tags',
blobs_url: 'https://api.github.com/repos/hoge/git/blobs{/sha}',
git_tags_url: 'https://api.github.com/repos/hoge/git/tags{/sha}',
git_refs_url: 'https://api.github.com/repos/hoge/git/refs{/sha}',
trees_url: 'https://api.github.com/repos/hoge/git/trees{/sha}',
statuses_url: 'https://api.github.com/repos/hoge/statuses/{sha}',
languages_url: 'https://api.github.com/repos/hoge/languages',
stargazers_url: 'https://api.github.com/repos/hoge/stargazers',
contributors_url: 'https://api.github.com/repos/hoge/contributors',
subscribers_url: 'https://api.github.com/repos/hoge/subscribers',
subscription_url: 'https://api.github.com/repos/hoge/subscription',
commits_url: 'https://api.github.com/repos/hoge/commits{/sha}',
git_commits_url: 'https://api.github.com/repos/hoge/git/commits{/sha}',
comments_url: 'https://api.github.com/repos/hoge/comments{/number}',
issue_comment_url: 'https://api.github.com/repos/hoge/issues/comments{/number}',
contents_url: 'https://api.github.com/repos/hoge/contents/{+path}',
compare_url: 'https://api.github.com/repos/hoge/compare/{base}...{head}',
merges_url: 'https://api.github.com/repos/hoge/merges',
archive_url: 'https://api.github.com/repos/hoge/{archive_format}{/ref}',
downloads_url: 'https://api.github.com/repos/hoge/downloads',
issues_url: 'https://api.github.com/repos/hoge/issues{/number}',
pulls_url: 'https://api.github.com/repos/hoge/pulls{/number}',
milestones_url: 'https://api.github.com/repos/hoge/milestones{/number}',
notifications_url: 'https://api.github.com/repos/hoge/notifications{?since,all,participating}',
labels_url: 'https://api.github.com/repos/hoge/labels{/name}',
releases_url: 'https://api.github.com/repos/hoge/releases{/id}',
deployments_url: 'https://api.github.com/repos/hoge/deployments',
created_at: '2020-12-08T11:09:29Z',
updated_at: '2022-03-23T09:54:35Z',
pushed_at: '2022-04-01T06:54:43Z',
git_url: 'git://github.com/hoge.git',
ssh_url: 'git@github.com:hoge.git',
clone_url: 'https://github.com/hoge.git',
svn_url: 'https://github.com/hoge',
homepage: '',
size: 146,
stargazers_count: 0,
watchers_count: 0,
language: null,
has_issues: true,
has_projects: true,
has_downloads: true,
has_wiki: true,
has_pages: false,
forks_count: 0,
mirror_url: null,
archived: false,
disabled: false,
open_issues_count: 0,
license: null,
allow_forking: true,
is_template: false,
topics: [],
visibility: 'public',
forks: 0,
open_issues: 0,
watchers: 0,
default_branch: 'main',
permissions: {
  admin: true,
  maintain: true,
  push: true,
  triage: true,
  pull: true
},
temp_clone_token: '',
allow_squash_merge: true,
allow_merge_commit: true,
allow_rebase_merge: true,
allow_auto_merge: false,
delete_branch_on_merge: false,
allow_update_branch: false,
network_count: 0,
subscribers_count: 1
} githubProject.data
```

他にも企業の課題に合わせた様々なシステムを開発しています

ソリューション・開発事業について詳しく  
TOP技術関連記事各GitのWebhook連携を行う、GitLabとGitHubのnpmライブラリを使用して必要なプロジェクト情報を取得する