Add external scheduler examples for cloud platforms#89
Open
ezzatron wants to merge 23 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use octokit's App client to discover the installation for a repository and dispatch the configured workflow. Add unit tests that mock the octokit module and cover the expected request flow, 404 handling, and error propagation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add thin Cloudflare, AWS, GCP, and Azure wrappers around\nexternal dispatch(). Each entrypoint reads platform config\nfrom bindings or environment variables and forwards it to\nthe shared dispatcher.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a build script and Makefile integration for the external\nscheduler example bundles. Also ignore those generated dist\ndirectories in ESLint so precommit can verify generated files\nwithout linting bundle output.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #89 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 44 49 +5
Lines 1210 1265 +55
Branches 283 293 +10
=========================================
+ Hits 1210 1265 +55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds external scheduler examples that dispatch the token-provider workflow from serverless schedulers across major cloud platforms, with shared Octokit-based GitHub App authentication and generated deployment bundles.
Changes:
- Introduces shared workflow dispatch logic plus AWS, Azure, GCP, and Cloudflare scheduler entrypoints with unit tests.
- Adds build and generated-file verification wiring for external scheduler bundles.
- Adds platform deployment docs/configuration and an ADR for using Octokit App authentication.
Reviewed changes
Copilot reviewed 26 out of 35 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
tsconfig.json |
Excludes generated/example deployment artifacts from project typechecking. |
src/external-scheduler/dispatch.ts |
Adds shared GitHub App workflow dispatch implementation. |
src/external-scheduler/dispatch.spec.ts |
Tests dispatch authentication, installation lookup, and workflow dispatch behavior. |
src/external-scheduler/aws/index.ts |
Adds AWS Lambda scheduler handler. |
src/external-scheduler/aws/index.spec.ts |
Tests AWS handler environment parsing and dispatch calls. |
src/external-scheduler/azure/index.ts |
Adds Azure timer trigger handler. |
src/external-scheduler/azure/index.spec.ts |
Tests Azure handler environment parsing and dispatch calls. |
src/external-scheduler/gcp/index.ts |
Adds GCP Cloud Function handler. |
src/external-scheduler/gcp/index.spec.ts |
Tests GCP handler environment parsing and dispatch calls. |
src/external-scheduler/cloudflare/index.ts |
Adds Cloudflare scheduled Worker handler. |
src/external-scheduler/cloudflare/index.spec.ts |
Tests Cloudflare env binding dispatch behavior. |
script/build-external-schedulers.ts |
Adds esbuild bundling for all scheduler examples. |
Makefile |
Registers scheduler bundles as generated files. |
eslint.config.js |
Ignores generated scheduler bundle directories. |
.prettierignore |
Ignores generated example bundle directories. |
examples/external-scheduler/README.md |
Adds top-level external scheduler guide. |
examples/external-scheduler/aws-lambda/README.md |
Adds AWS Lambda deployment guide. |
examples/external-scheduler/aws-lambda/template.yaml |
Adds SAM/EventBridge scheduler configuration. |
examples/external-scheduler/azure-function/README.md |
Adds Azure Functions deployment guide. |
examples/external-scheduler/azure-function/function.json |
Adds Azure timer trigger binding. |
examples/external-scheduler/azure-function/host.json |
Adds Azure Functions host configuration. |
examples/external-scheduler/gcp-cloud-function/README.md |
Adds GCP Cloud Function and Cloud Scheduler guide. |
examples/external-scheduler/gcp-cloud-function/package.json |
Adds package metadata for GCP deployment. |
examples/external-scheduler/cloudflare-worker/README.md |
Adds Cloudflare Worker deployment guide. |
examples/external-scheduler/cloudflare-worker/package.json |
Adds package metadata for Cloudflare example. |
examples/external-scheduler/cloudflare-worker/wrangler.toml |
Adds Worker cron trigger and environment config. |
docs/adrs/0031-use-octokit-app-for-external-scheduler-dispatch.md |
Documents the Octokit App authentication decision. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dispatch function now validates that the repo string is exactly owner/repo format before making API calls, and resolves the target repository's default branch instead of hard-coding 'main'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor HTTP handler to avoid async callback in createServer. Update GCP Cloud Function reference to Cloud Run. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AWS: fetch from Secrets Manager at runtime. Template creates the secret resource with IAM policy; user populates post-deploy. Azure: ARM template creates Key Vault with RBAC, assigns the Function App's managed identity the Secrets User role, and uses a Key Vault reference in app settings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix Makefile rule target (gcp-cloud-function → gcp-cloud-run) - Restrict GCP endpoint to POST requests (405 otherwise) - Use vi.hoisted() for mockListen in GCP spec - Add test for non-Error rejection and method check - Delete ephemeral docs/superpowers/ plan and spec files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace function.json timer binding with app.timer() registration from @azure/functions v4. Delete function.json (no longer needed), add package.json with main entry, mark @azure/functions as external in the esbuild config since the runtime provides it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add @azure/functions dependency to Azure package.json so the external import resolves at runtime. Update README to reference code-based timer registration instead of deleted function.json. Add CodeUri to AWS SAM template so sam deploy packages the bundle. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds ready-to-deploy external scheduler examples for Cloudflare Workers, AWS Lambda, GCP Cloud Run, and Azure Functions. Each triggers the token-provider workflow via
workflow_dispatchon a 30-minute schedule using GitHub App auth through theoctokitpackage.What's included
src/external-scheduler/dispatch.ts) — shared logic using octokit'sAppclass for auth, retry, and throttling; validates repo format and resolves the default branch via the APImake precommitMotivation
GitHub Actions cron schedules are unreliable — runs can be delayed or skipped. Users need an external scheduler to guarantee at least one successful workflow dispatch per hour.