Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Manage GitHub Actions Using GitHub REST API

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

import getpass
import json
import requests
from github_rest_api import Repository
import os
import subprocess
from getpass import getpass
from requests.exceptions import HTTPError
from github_rest_api import Organization, Repository, RepositoryType, User

env = os.environ.copy()
env["GOPASS_AGE_PASSWORD"] = getpass("Enter gopass password: ")
token = subprocess.run(
    ["gopass", "show", "-o", "github.com/token"],
    check=True,
    capture_output=True,
    text=True,
    env=env,
).stdout
repo = Repository(token="", repo="legendu-net/github_rest_api")
resp = repo.get(
    url="https://api.github.com/repos/legendu-net/github_rest_api/actions/artifacts"
)
resp.json()
{'total_count': 0, 'artifacts': []}