Esempio n. 1
0
    def testCreateJWT(self):
        from github import GithubIntegration

        integration = GithubIntegration(25216, private_key)
        token = integration.create_jwt()
        payload = jwt.decode(
            token, key=public_key, algorithms=["RS256"], options={"verify_exp": False},
        )
        self.assertDictEqual(
            payload, {"iat": 1550055331, "exp": 1550055391, "iss": 25216}
        )
Esempio n. 2
0
 def testCreateJWT(self):
     from github import GithubIntegration
     integration = GithubIntegration(25216, private_key)
     token = integration.create_jwt()
     payload = jwt.decode(
         token,
         key=public_key,
         algorithm="RS256",
         options={'verify_exp': False},
     )
     self.assertDictEqual(payload, {
         'iat': 1550055331,
         'exp': 1550055391,
         'iss': 25216
     })
Esempio n. 3
0
 def testCreateJWT(self):
     from github import GithubIntegration
     integration = GithubIntegration(25216, private_key)
     token = integration.create_jwt()
     payload = jwt.decode(
         token,
         key=public_key,
         algorithm="RS256",
         options={'verify_exp': False},
     )
     self.assertDictEqual(
         payload,
         {
             'iat': 1550055331,
             'exp': 1550055391,
             'iss': 25216
         }
     )
Esempio n. 4
0
    APPID = myfile.read().strip()
with open(
        os.environ['HOME'] +
        "/.ssh/github.app.sphenix-jenkins-ci.installationid", "r") as myfile:
    INSTALLATIONID = myfile.read().strip()
with open(
        os.environ['HOME'] +
        "/.ssh/github.app.sphenix-jenkins-ci.private-key.pem", 'rb') as fh:
    signing_key = fh.read()

print(
    f"Authentication with private key for app {APPID} installation {INSTALLATIONID} ..."
)

integration = GithubIntegration(APPID, signing_key)
jwt_token = integration.create_jwt()
access_obj = integration.get_access_token(INSTALLATIONID)

# pprint.pprint(access_obj.__dict__);

#########################
# Talk to GitHub
#########################

gh = Github(login_or_token=access_obj.token)

# pprint.pprint(gh.__dict__);

org = gh.get_organization(checkrun_organziation)
repo = org.get_repo(checkrun_repo)
commitObj = repo.get_commit(checkrun_commit)
import discord

from os import urandom
from github import Github, GithubIntegration
from src.defines import TOKEN, GUILD, TARGET_CHANNEL, GITHUB_APP_ID, GITHUB_CLIENT_ID
from src.input_proccesors.vote import Vote
from src.input_proccesors.suggestion import Suggestion

github_integration = GithubIntegration(GITHUB_APP_ID, open('angry-villager.2020-10-03.private-key.pem', 'r').read())
installation = github_integration.get_installation('OutlawByteStudios', 'KingdomsDiscordBot')
token = github_integration.create_jwt()


github_client = Github('v1.e9827ef3291f575ac58d4def4ab428afc868806e')
client = discord.Client()

# Suggestions project = 5594461
# Suggestions column = 11079851
# Project Plan project id = 5594457
project_kingdoms_suggestions_repo = github_client.get_repo(
    'OutlawByteStudios/KingdomsDiscordBot')
suggestion_column = github_client.get_project_column(11079851)
suggestion_label = project_kingdoms_suggestions_repo.get_label('suggestion')


vote = Vote(project_kingdoms_suggestions_repo)
suggestion = Suggestion(project_kingdoms_suggestions_repo,
                        suggestion_column, suggestion_label)

print(f'Repo has {project_kingdoms_suggestions_repo.open_issues} open issues')