标签: github-api

github api 比较提交,响应状态存在分歧

在配置jenkins时,我想检测功能分支是否存在合并冲突,因此我使用github api v3在2个故意冲突的分支上进行测试。

将branch1合并到master后,我比较了branch2(b2),如下所示:

curl -i https://api.github.com/repos/hao1987/myself/compare/hao1987:master...hao1987:b2
Run Code Online (Sandbox Code Playgroud)

它返回一个长 json,它有一个属性:

"status": "diverged"

我想知道这是否意味着冲突,以及我可以在哪里尝试“状态”类型

conflict github-api jenkins

3
推荐指数
1
解决办法
904
查看次数

为什么 github api 给我的仓库的星数较低?

我使用以下代码来获取存储库的星星,但它只返回 Bootstrap 存储库的 40000 颗星,这低于实际的 70717 颗星。但是它返回 JQuery 存储库的正确星星(31445)。为什么Bootstrap检索星星不正确?

#!/usr/bin/python
from github import Github
# XXX: Specify your own access token here
ACCESS_TOKEN = ''
client = Github(ACCESS_TOKEN, per_page=100)
# Specify a username and repository of interest for that user.
REPO_LIST=[('twbs','bootstrap'),('jquery','jquery')]
for USER,REPO in REPO_LIST:
    user = client.get_user(USER)
    repo = user.get_repo(REPO)
    # Get a list of people who have bookmarked the repo.
    # Since you'll get a lazy iterator back, you have to traverse
    # it if you want to …
Run Code Online (Sandbox Code Playgroud)

github github-api python-3.x

3
推荐指数
1
解决办法
1007
查看次数

这个 AttributeError: recurse 是什么?相关黑帽python第7章github命令与控制

【我的开发环境】

root@kali:~# python

Python 2.7.3 (default, Mar 14 2014, 11:57:14) 

[GCC 4.7.2] on linux2
Run Code Online (Sandbox Code Playgroud)

参考网址

[这是示例源代码]

git_trojan.py

import json
import base64
import sys
import time
import imp
import random
import threading
import Queue
import os

from github3 import login

trojan_id = "abc"

trojan_config = "%s.json" % trojan_id
data_path     = "data/%s/" % trojan_id
trojan_modules= []

task_queue    = Queue.Queue()
configured    = False

class GitImporter(object):

    def __init__(self):

        self.current_module_code = ""


    def find_module(self,fullname,path=None):

        if configured:
            print("[*] Attempting to retrieve %s" % fullname)
            new_library = …
Run Code Online (Sandbox Code Playgroud)

python linux github github-api

3
推荐指数
1
解决办法
480
查看次数

Github api 不解析多行 shell 变量

我在 jenkins 配置中有一个文本参数(来自 jenkins job dsl 插件),它允许您输入多行注释。从 shell 脚本向 github 存储库发布版本时,我使用该变量作为主体值。我收到这个错误,说解析 json 有问题,我找不到解决方法。我会在下面给你举个例子。请帮忙。

PERSONAL_ACCESS_TOKEN="random"
TAG_NAME="12.0.0"
VERSION_BUMP="major"
MIGRATION_DOCUMENT="This is first line
This is second line"

curl -i \
-H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" \
-d '{"tag_name": "'"${TAG_NAME}"'", "name": "'"${VERSION_BUMP}"'", \
"body": "'"${MIGRATION_DOCUMENT}"'"}' \
https://github.deere.com/api/v3/repos/randomOrg/testRepo/releases
Run Code Online (Sandbox Code Playgroud)

shell json github-api

3
推荐指数
1
解决办法
642
查看次数

GitHub GraphQL 获取未归档的存储库

有没有办法只获取未归档的存储库?

{
  user(login: "SrikanthBandaru") {
    id
    email
    isHireable
    name
    repositories(first: 100) { # fetch only the repos that are not archived
      edges {
        node {
          name
          isArchived
          shortDescriptionHTML
          description
          descriptionHTML
          repositoryTopics(first: 10) {
            edges {
              node {
                topic {
                  name
                }
              }
            }
          }
          homepageUrl
          url
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

github-api graphql github-graphql

3
推荐指数
1
解决办法
598
查看次数

使用 github webhook 读取文档导致 400:“有效负载无效、无效或缺少签名”

我已按照https://docs.readthedocs.io/en/stable/webhooks.html上的说明操作,并向 github 添加了一个 webhook 以触发我构建的 readthedocs,但是 readthedocs 拒绝了有效负载:

Response

Status:
    400
Content-Type:
    text/html; charset=utf-8
Allow:
    POST, OPTIONS
Run Code Online (Sandbox Code Playgroud)

细节:

{
  "detail": "Payload not valid, invalid or missing signature"
}
Run Code Online (Sandbox Code Playgroud)

这是请求的标头:

Host:
    ...
Connection:
    close
Accept:
    */*
Max-Forwards:
    10
User-Agent:
    GitHub-Hookshot/903858c
X-Github-Event:
    push
X-Github-Delivery:
    2be06d44-552f-11e9-91f6-d1c2bea59bd2
X-Original-Host:
    readthedocs.org
X-Original-Url:
    /api/v2/webhook/.../.../
X-Arr-Ssl:
    2048|256|C=GB, S=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA|OU=Domain Control Validated, OU=EssentialSSL Wildcard, CN=*.readthedocs.org
X-Arr-Log-Id:
    fef5ee2e-6edd-4386-ad1f-79400cee2d46
Content-Type:
    application/json 
Run Code Online (Sandbox Code Playgroud)

带有效载荷:

{
  "after": "..."
  "base_ref": null,
  "before": …
Run Code Online (Sandbox Code Playgroud)

github github-api read-the-docs github-webhook

3
推荐指数
1
解决办法
498
查看次数

GitHub API:是否会在拉取请求批准事件上触发 webhook?

每当拉取请求审查被标记为“已批准”时,我都需要能够通过网络钩子启动流程。我知道有一种方法可以通过 API 查询拉取请求以确定状态、批准数量等,但这无济于事。我正在寻找一种方法,可以在每次有人批准请求时立即调用流程。不过,这个特定事件似乎不会触发 webhook。那是对的吗?有没有办法做到这一点?

先感谢您!

github github-api

3
推荐指数
1
解决办法
1581
查看次数

有没有办法从命令行或 git 在 GitHub Private 中创建所有存储库/存储库?

我想遍历我的 GitHub 帐户并将我的所有 repo 设置为 Private。

我搜索了一下,不知道该怎么做?

git github repository github-api

3
推荐指数
1
解决办法
2171
查看次数

Javascript在地图内获取

我有一个网站/投资组合,我在其中使用 Github API 显示我的所有项目。我的目标是为这些项目创建一个过滤器,所以我在一些名为“built-with.json”的存储库的根目录中创建了一个文件,该文件仅存在于两个存储库中仅用于测试目的,这是我的一系列技术在项目中使用(例如:["React", "Javascript", ...])。所以我需要获取 Github APi(它运行良好的那部分),然后获取该文件,并返回一个新的项目数组,但带有一个“过滤器”键,其中值是“built-with.json”中的数组. 例子:

Github API 返回(仅返回一个项目的示例):

[{
"id": 307774617,
"node_id": "MDEwOlJlcG9zaXRvcnkzMDc3NzQ2MTc=",
"name": "vanilla-javascript-utility-functions",
"full_name": "RodrigoWebDev/vanilla-javascript-utility-functions",
"private": false
}]
Run Code Online (Sandbox Code Playgroud)

我需要的新对象数组:

[{
"id": 307774617,
"node_id": "MDEwOlJlcG9zaXRvcnkzMDc3NzQ2MTc=",
"name": "vanilla-javascript-utility-functions",
"full_name": "RodrigoWebDev/vanilla-javascript-utility-functions",
"private": false,
"filters": ["HTML5", "CSS3", "JS", "React"]
}]
Run Code Online (Sandbox Code Playgroud)

这就是我所做的:

const url = "https://api.github.com/users/RodrigoWebDev/repos?per_page=100&sort=created";
fetch(url)
  .then((response) => response.json())
  .then((data) => {
      return data.map(item => {
        //item.full_name returns the repositorie name
        fetch(`https://raw.githubusercontent.com/${item.full_name}/master/built-with.json`)
          .then(data => {
            item["filters"] = data
            return item
          })
      })
    })
  .then(data => console.log(data)) …
Run Code Online (Sandbox Code Playgroud)

javascript arrays fetch github-api fetch-api

3
推荐指数
2
解决办法
3405
查看次数

是否有一个稳定的 url 可以始终在 github 中获取默认分支?

过去,在大多数情况下,您只需添加blob/master/ to a github url get the raw file, i.e. https://github.com/jacoco/jbang-catalog/blob/master/jbang-catalog.json`

现在使用旧存储库,master但使用main该技巧的新存储库不适用于新存储库。

有没有办法避免调用 rest api 来查找默认分支 main ?

像魔法标记之类的blob/@default/?

github github-api

3
推荐指数
1
解决办法
239
查看次数