GitHub Interaction Skill
This skill outlines how to handle interactions with GitHub, including authentication and repository manipulation.
Authentication (Device Flow)
Since AxKeyStore is a CLI tool, use the GitHub Device Authorization Flow.
- •Request Device Code: POST
https://github.com/login/device/codewithclient_id. - •User Prompt: Display
user_codeand theverification_urito the user. - •Poll for Token: Poll
https://github.com/login/oauth/access_tokenuntil the user authorizes. - •Storage: Save the resulting
access_tokenlocally.
Repository Operations
Use the GitHub REST API (v3) to read and write files.
Reading a File
- •Endpoint:
GET /repos/{owner}/{repo}/contents/{path} - •Headers:
Authorization: token OAUTH_TOKEN,Accept: application/vnd.github.v3+json - •Response: contains
content(base64 encoded) andsha.
Writing/Updating a File
- •Endpoint:
PUT /repos/{owner}/{repo}/contents/{path} - •Body:
json
{ "message": "Update keys", "content": "BASE64_ENCODED_CONTENT", "sha": "FILE_SHA" // Required if updating, omit if creating new } - •Note: Always fetch the latest
shabefore updating to avoid conflicts.
Crates
- •Recommend using
reqwestfor raw control oroctocrabif interaction is complex. - •Ensure
serde_jsonis used for parsing responses.