Docs
GitHub

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

  1. Create a Custom Flow: Follow the webhook integration guide (opens in a new tab).
  2. Use Pre-built Templates: Start with our webhook template (opens in a new tab).

Step 2: Add GitHub Secrets

  1. Go to your repository's Settings > Secrets and Variables > Actions.
  2. 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

ParameterDescriptionRequiredExample
webhook_urlThe URL of the webhook to send data tohttps://example.com/webhook
webhook_keyThe authorization key for the webhookyour_webhook_key
github_refThe GitHub reference (branch) to work withrefs/heads/main
file_typeThe file extension to detect and send (e.g., mdx)mdx
modeThe mode to operate in: incremental or full-refreshincremental
verboseEnable 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

ProblemSolution
Webhook Not TriggeringEnsure the webhook URL is correct and reachable.
File Changes Not DetectedConfirm the paths section in the workflow file matches your use case.
Authorization ErrorsVerify the WEBHOOK_KEY secret is correctly set.
Verbose Mode Not WorkingEnsure 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.

Was this page useful?

Questions? We're here to help

Subscribe to updates