https://github.com/oldes/rebol-github
Rebol module for GitHub GraphQL and REST APIs
https://github.com/oldes/rebol-github
Last synced: 10 months ago
JSON representation
Rebol module for GitHub GraphQL and REST APIs
- Host: GitHub
- URL: https://github.com/oldes/rebol-github
- Owner: Oldes
- Created: 2024-11-06T14:36:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-11T10:17:23.000Z (about 1 year ago)
- Last Synced: 2025-03-09T18:02:02.633Z (10 months ago)
- Language: Rebol
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/Oldes/Rebol-GitHub/actions/workflows/main.yml)
[](https://app.gitter.im/#/room/#Rebol3:gitter.im)
# Rebol/GitHub
GitHub APIs ([GraphQL](https://docs.github.com/en/graphql) and [REST](https://docs.github.com/en/rest?apiVersion=2022-11-28)) module for [Rebol3](https://github.com/Oldes/Rebol3) (version 3.14.1 and higher)
## Configuration
This module expects the `github-token` value to be present in the user's data. A new user and token can be set using code like:
```rebol
set-user/n Test ;; Creates or loads data for the Test user (prompts for a password if needed)
if none? user's github-token [
;; If no GitHub token is stored, add a new token:
put system/user/data 'github-token "token 113d8...be2"
;; Save updated data to disk:
update system/user/data
]
;; Once the GitHub token is stored, one can import the module:
import 'github
```
## GraphQL API Usage example
```rebol
;; Initialize variables for the GraphQL API:
data: #[owner: "Oldes" repo: "Rebol3"]
;; Resolve the current user’s identity:
probe github-query {query {viewer {login}}} none
;; Retrieve the last 10 commits:
probe github-query 'last-10-commits :data
```
## REST API Usage example
```rebol
;; List all of supported `get` functions:
help github-get
;; List all of supported `post` functions:
help github-post
;; List all of supported `edit` functions:
help github-edit
;; Set the repository for REST API calls:
github-repo ["Oldes" "Rebol3"]
;; Retrieve all repository workflows:
probe github-get/workflows
```
Check the [CI-test script](https://github.com/Oldes/Rebol-GitHub/blob/main/ci-test.r3) for more examples.