Skip to main content

Tutorial: Github Content Manager Agent

This Agent is designed to help you manage your GitHub repository content. The capabilities include retrieving the content of a repository, including specific files like README.md. It can also create and update file content. The aim is to help you navigate and handle your GitHub repositories with ease.

GitHub Access Tokens

  1. Navigate to https://github.com.
  2. In the upper-right corner of the page, click your profile photo.
alt text
  1. Then, click Settings.
alt text
  1. In the left sidebar, scroll down then click Developer settings.
alt text
  1. In the left sidebar, click Personal tokens then click Generate New Token (classic).
alt text
  1. Add a note to your Token, set the expiration, and then checkmark the scopes.
alt text
  1. Then, click the Generate Token button.
alt text
  1. Make sure to copy your personal access token because you won’t be able to see it again.
    1. Example: ghp_wtOAM5BSYSCgnTN5elXEUAerngae4P3pqFmc
alt text

GitHub Repository Owner & Name

You can skip this step if you already have your Repositories.

  1. In the upper-right corner of the GitHub page, click your profile photo.
alt text
  1. Then, click Settings.
alt text
  1. In the left sidebar, go to Code, Planning, and Automation then click Repositories.
alt text
  1. Click create one.
alt text
  1. The owner’s name will be automatically created, you only need to input your repository name.
    1. Example:
      1. Repository Owner: janicesmyth
      2. Repository Name: SmythOS-GitHub-Manager
alt text
  1. Then, click the Create Repository button.
alt text

Agent Setup

  1. In SmythOS, navigate to the Templates tab.
alt text
  1. You can scroll down to find the GitHub Content Manager or simply search for it in the Search tab, then click the Remix button.
alt text
  1. Allow the template to initialize and configure.

GitHub Integrations Setup

  1. In SmythOS, look for GitHub integration components. This agent utilized five GitHub component integrations. Click the gear icon to open the settings.
alt text
  1. Click the key icon and select your GitHub Access Token stored in your vault. Remember to click the check mark to save your configuration.
  2. Note: Click here to learn more about adding your API keys to the vault.

alt text
  1. You’re all set!

Test the Agent

Open the ChatBot embodiment and click on the chat icon.

alt text

Note: GitHub handles the file content encoded in base64.

Create a New file

  1. Sample Prompt:
    • Create a new file in SmythOS-GitHub-Manager with the following:
    • File content: aGVsbG8=
    • Path: text11.txt
    • Commit message: agent message
    • Name: janice
    • Email: janice@inkco.co

Note: The file content is hello.

alt text
  1. The agent will verify that the file has been successfully created in your GitHub repository.
alt text
  1. You can review your GitHub account to find the newly created file.
alt text

Update File Content

  1. Sample Prompt:
    • Update the file content in SmythOS-GitHub-Manager with the following information:
    • File content: dXBkYXRlIHN1Y2Nlc3NmdWw=
    • Path: text11.txt
    • Commit message: agent message
    • Name: janice
    • Email: janice@inkco.co

Note: The file content is update successful.

alt text
  1. The agent will verify that the file has been successfully updated in your GitHub repository.
alt text
  1. The file content before the update was hello.
alt text
  1. Following the update, here is the result.
alt text

Get Repository Content

  1. Sample Prompt:
    • Get repository content from text11.txt
alt text
  1. Here’s the result.
alt text
  1. Since the content is in base64, the agent is equipped to decode it for your convenience. Just type, Yes.
alt text
  1. Here’s the result.
alt text

Get all Repository Content

  1. Sample Prompt:
    • Get all repository content.
alt text
  1. In GitHub, these are the current contents.
alt text
  1. Here’s the result from the agent.
alt text

Get ReadMe

  1. Sample Prompt:
    • Get READ ME file.
alt text
  1. Here’s the result.
alt text
alt text