Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/sync-from-monorepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Sync skills from monorepo

on:
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
sync:
runs-on: ubuntu-latest
if: github.repository == 'triggerdotdev/skills'
steps:
- uses: actions/checkout@v4

- name: Fetch monorepo skills
run: |
git clone --depth 1 --filter=blob:none --no-checkout \
https://github.com/triggerdotdev/trigger.dev.git monorepo
git -C monorepo sparse-checkout set --no-cone packages/cli-v3/skills
git -C monorepo checkout
echo "MONOREPO_SHA=$(git -C monorepo rev-parse HEAD)" >> "$GITHUB_ENV"

- name: Apply sync map
run: |
set -euo pipefail
SRC=monorepo/packages/cli-v3/skills
jq -r 'to_entries[] | "\(.key)\t\(.value)"' sync-map.json |
while IFS=$'\t' read -r src dst; do
[ -d "$SRC/$src" ] || { echo "::warning::mapped skill '$src' not found in monorepo"; continue; }
rm -rf "./$dst"
cp -R "$SRC/$src" "./$dst"
done
comm -23 \
<(find "$SRC" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort) \
<(jq -r 'keys[]' sync-map.json | sort) \
| sed 's/^/::warning::unmapped monorepo skill: /'
rm -rf monorepo

- name: Open or update pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to sync."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B sync/monorepo-skills
git add -A
git commit -m "chore: sync skills from triggerdotdev/trigger.dev@${MONOREPO_SHA:0:7}"
git push --force-with-lease origin sync/monorepo-skills
body="Automated weekly sync from [\`triggerdotdev/trigger.dev@${MONOREPO_SHA:0:7}\`](https://github.com/triggerdotdev/trigger.dev/commit/${MONOREPO_SHA}).

Mappings live in \`sync-map.json\`. To publish a new monorepo skill, add an entry there. See the workflow run for any unmapped skills."
existing=$(gh pr list --head sync/monorepo-skills --state open --json number --jq '.[0].number // empty')
if [ -n "$existing" ]; then
gh pr edit "$existing" --body "$body"
else
gh pr create --head sync/monorepo-skills --base main \
--title "chore: sync skills from monorepo" --body "$body"
fi
5 changes: 5 additions & 0 deletions sync-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"getting-started": "trigger-setup",
"authoring-tasks": "trigger-tasks",
"realtime-and-frontend": "trigger-realtime"
}