This GitHub Action enables you to automatically upload files from your repository to a mainbot API endpoint.
glob-pattern
Required The glob pattern used to find files in the repository. Default: ./docs/**
.
namespace
Required The namespace of the mainbot API endpoint.
api-url
Required The Mainbot API endpoint to which files will be uploaded.
client-id
Optional The client ID for OAuth authentication, if required by your API.
client-secret
Optional The client secret for OAuth authentication, if required by your API.
token-endpoint
Optional The token endpoint for OAuth authentication, if required by your API.
client_id
and client_secret
) if the target API requires OAuth authentication.Add GitHub Action to Your Repository
Create a .github/workflows
directory in the root of your repository (if it doesn't already exist), and add a new YAML file for your workflow (e.g., upload-files.yml
).
Configure Workflow File
Set up your workflow file with the required steps. Below is an example configuration:
name: Upload Files to API
on:
workflow_dispatch: {} # Enable manual triggering
push:
branches:
- main # Set your branch here
paths:
- 'docs/**' # Set your docs folder path here
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Upload Files
uses: savantly-net/mainbot-github-action@main
with:
glob-patterns: '**/*.txt' # Set your file pattern here
namespace: '/admin'
api-url: 'https://mainbot.savantly.net' # Set your Mainbot API endpoint here
client-id: ${{ secrets.CLIENT_ID }} # Set your client ID here
client-secret: ${{ secrets.CLIENT_SECRET }} # Set your client secret here
token-endpoint: 'https://mainbot.savantly.net/oauth/token' # Set your token endpoint here
Set GitHub Secrets
Go to your repository's Settings > Secrets and add your CLIENT_ID
and CLIENT_SECRET
.
Once installed, the action will run automatically based on the defined triggers in your workflow file (e.g., on every push to the main
branch). The action will:
For support, issues, or feature requests, please file an issue on the GitHub repository.