GitHub Action Documentation
This GitHub Action detects changes to specified file types in your repository and sends the file content to a webhook. It allows seamless integration with external services like Lamatic Flow for further processing.
Features
✅ Key Functionalities
- File Monitoring: Automatically detects when files are added or modified.
- Webhook Integration: Sends file contents to external services securely.
- Security Features: Supports GitHub Secrets for secure data handling.
✅ Benefits
- Automates workflows triggered by file changes.
- Enables integration with custom and pre-built Lamatic Flow templates.
- Offers robust configuration for selective file monitoring.
Prerequisites
Before setting up the GitHub Action, ensure you have the following:
- A webhook URL for receiving notifications.
- A valid webhook authorization key (if required).
- Proper permissions to create GitHub Secrets in your repository.
Installation
Step 1: Set Up Lamatic Flow
- Create a Custom Flow: Follow the webhook integration guide (opens in a new tab).
- Use Pre-built Templates: Start with our webhook template (opens in a new tab).
Step 2: Add GitHub Secrets
- Go to your repository's Settings > Secrets and Variables > Actions.
- Add the following secrets:
WEBHOOK_URL
: The URL of your webhook.WEBHOOK_KEY
: The authorization key for your webhook (if required).
Step 3: Configure GitHub Workflow
Create a workflow file in .github/workflows/
(e.g., file-monitor.yml
) with the following configuration.
Configuration Reference
Parameter | Description | Required | Example |
---|---|---|---|
webhook_url | The URL of the webhook to send data to | ✅ | https://example.com/webhook |
webhook_key | The authorization key for the webhook | ✅ | your_webhook_key |
github_ref | The GitHub reference (branch) to work with | ✅ | refs/heads/main |
file_type | The file extension to detect and send (e.g., mdx ) | ✅ | mdx |
mode | The mode to operate in: incremental or full-refresh | ✅ | incremental |
verbose | Enable verbose output (true or false ) | ❌ | true |
Usage
Low-Code Example
- name: Send File Changes to Webhook
uses: Lamatic/[email protected]
with:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_key: ${{ secrets.WEBHOOK_KEY }}
github_ref: ${{ github.ref }}
file_type: "mdx"
mode: "incremental"
verbose: "true"
Full Workflow Example
name: Lamatic Index Flow
on:
push:
branches:
- main
paths:
- "**.mdx" # Monitor specific file types
jobs:
send-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Send File Changes to Webhook
uses: Lamatic/[email protected]
with:
webhook_url: ${{ secrets.WEBHOOK_URL }}
webhook_key: ${{ secrets.WEBHOOK_KEY }}
github_ref: ${{ github.ref }}
file_type: "mdx"
mode: "incremental"
verbose: "true"
Troubleshooting
Common Issues
Problem | Solution |
---|---|
Webhook Not Triggering | Ensure the webhook URL is correct and reachable. |
File Changes Not Detected | Confirm the paths section in the workflow file matches your use case. |
Authorization Errors | Verify the WEBHOOK_KEY secret is correctly set. |
Verbose Mode Not Working | Ensure the verbose parameter is set to true . |
Debugging
- Check GitHub Action logs for detailed error information.
- Verify the webhook endpoint is receiving payloads by inspecting network requests.