Skip to content

ahapeter/aha-ops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aha-ops

Patrol cron trigger — calls a GitHub Actions workflow every 5 minutes.

Architecture

pg_cronSupabase Edge Function (patrol-trigger) → GitHub Actions (patrol-run.yml)

The edge function is secured with a custom x-cron-secret header. Requests without the correct secret are rejected with 401.

Deploy

# Link to your Supabase project
supabase link --project-ref <your-project-ref>

# Set secrets
supabase secrets set GITHUB_TOKEN=ghp_xxx
supabase secrets set CRON_SECRET=$(openssl rand -hex 32)

# Deploy the edge function (--no-verify-jwt since we use custom secret)
supabase functions deploy patrol-trigger --no-verify-jwt

Set up pg_cron (run once in Supabase SQL Editor)

create extension if not exists pg_net schema extensions;
create extension if not exists pg_cron;

select cron.schedule(
  'patrol-trigger-every-5min',
  '*/5 * * * *',
  $$
  select net.http_post(
    url := 'https://<your-project-ref>.supabase.co/functions/v1/patrol-trigger',
    headers := '{"x-cron-secret": "<your-cron-secret>"}'::jsonb,
    body := '{}'::jsonb
  );
  $$
);

Replace <your-project-ref> and <your-cron-secret> with your actual values.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors