On a schedule
Back up workflows to GitHub and document them in Notion
Each week your workflow definitions are saved to GitHub, and every changed workflow gets a plain-language description in your Notion database.
- Runs
- On a schedule
- Apps
- GitHub, Notion
- AI
- Yes, uses the built-in AI allowance
- Access
- GitHub contents:write; Notion read+write
Send this to your assistant
Create a ClickRuntime automation: every Sunday, fetch our workflow definitions, commit changed ones to acme/workflows, have AI describe each changed workflow, update its page in my Notion Workflows database, and tell #ops in Slack.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An operations team runs dozens of internal workflows built by different people over the years. Nobody is sure what half of them do, and when a builder leaves, their workflows become a mystery that nobody dares touch.
Backing up each workflow to GitHub and keeping a plain description of it in Notion gives the team both a safety net and a manual. New staff can read what each workflow does, and any change is recorded with its history.
What you get out of it
Workflows are documented
Every workflow has a Notion page explaining what it does in plain words. Knowledge does not leave with the person who built it.
Descriptions stay current
When a workflow changes, its description is rewritten. The documentation does not drift out of date.
History and recovery
GitHub keeps every version. A broken change can be compared and rolled back.
The team hears about changes
A Slack message lists what changed each week. Unexpected changes get questioned.
How it works
What happens, step by step
Every week, ClickRuntime fetches your workflow definitions.
It compares each with the copy in your GitHub repository and saves the ones that changed.
AI writes a plain-language description of each changed workflow.
The workflow's page in your Notion database is created or updated with the description and GitHub link.
A summary is posted to your #ops Slack channel.
Before it runs live
- Connect GitHub
- Connect Notion and share the database you want it to use
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other GitHub and Notion steps into one automation
Under the hood
The code that runs this automation
import base64, json
from clickruntime import on_trigger, credentials, http, notify, ai
def gh(method, path, **kw):
resp = http.request(method, f"https://api.github.com{path}", headers={
"Authorization": f"Bearer {credentials.connection('github', 'work')}", "Accept": "application/vnd.github+json"}, **kw)
return resp.raise_for_status() or (resp.json() if resp.content else None)
def notion(method, path, **kw):
resp = http.request(method, f"https://api.notion.com/v1{path}", headers={
"Authorization": f"Bearer {credentials.secret('NOTION_TOKEN')}", "Notion-Version": "2022-06-28"}, **kw)
return resp.raise_for_status() or resp.json()
REPO, DB, EXPORT_URL = "acme/workflows", "your-notion-database-id", "https://tools.acme.example/api/workflows"
@on_trigger
def run(event):
changed = []
for wf in http.get(EXPORT_URL, headers={"Authorization": f"Bearer {credentials.secret('EXPORT_TOKEN')}"}).json():
path, content = f"workflows/{wf['id']}.json", json.dumps(wf, indent=2, sort_keys=True) + "\n"
try:
current = gh("GET", f"/repos/{REPO}/contents/{path}")
except Exception:
current = None
if current and base64.b64decode(current["content"]).decode() == content:
continue
gh("PUT", f"/repos/{REPO}/contents/{path}", json={"message": f"Update {wf['name']}", "content": base64.b64encode(content.encode()).decode(), **({"sha": current["sha"]} if current else {})})
desc = ai.generate(content[:12000], system="Describe what this workflow does in 3 plain sentences for a new team member.", max_output_tokens=200).text
props = {"Name": {"title": [{"text": {"content": wf["name"]}}]}, "Description": {"rich_text": [{"text": {"content": desc}}]},
"GitHub": {"url": f"https://github.com/{REPO}/blob/main/{path}"}}
found = notion("POST", f"/databases/{DB}/query", json={"filter": {"property": "Name", "title": {"equals": wf["name"]}}})["results"]
notion("PATCH", f"/pages/{found[0]['id']}", json={"properties": props}) if found else notion("POST", "/pages", json={"parent": {"database_id": DB}, "properties": props})
changed.append(wf["name"])
if changed:
notify.slack("Workflows backed up and documented: " + ", ".join(changed), channel="#ops")
return {"changed": changed}FAQ
Common questions
What does the Notion database need?
Are unchanged workflows described again?
Can my team edit the descriptions?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a pre-meeting briefing from GitHub and Notion
Before each engineering meeting, Slack gets a short briefing with recent pull requests and issues and the latest notes from your Notion meeting page.
See how it worksFlag Notion docs that are older than your latest release
When a new release ships on GitHub, Slack lists the Notion docs pages for that product that have not been updated since before the release.
See how it worksAdd new GitHub issues to a Notion board with AI triage
Every new GitHub issue appears on your Notion board with a type and priority already set, and a link back to GitHub.
See how it worksKeep exploring
Set up “Back up workflows to GitHub and document them in Notion” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.