-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add modify existing workflow action and output schema validation #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
e7bddc0
2ccdb75
f4eb83b
0579a46
e094e0d
a0df5e9
bd69c8d
22d87ba
c66b258
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Schema Update | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 3 * * 1' # Monday 3AM UTC | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| actions: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - run: bun install | ||
|
|
||
| - name: Generate schemas | ||
| run: bun run crawl | ||
| env: | ||
| N8N_API_KEY: ${{ secrets.N8N_API_KEY }} | ||
| N8N_HOST: ${{ secrets.N8N_HOST }} | ||
|
|
||
| - run: bun run build | ||
|
|
||
| - name: Download latest release | ||
| run: | | ||
| mkdir -p /tmp/latest | ||
| bunx npm pack @elizaos/plugin-n8n-workflow@latest --pack-destination /tmp | ||
| tar xzf /tmp/elizaos-plugin-n8n-workflow-*.tgz -C /tmp/latest | ||
|
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First-release scenario will fail silently. If ♻️ Suggested fix - name: Download latest release
+ id: download
+ continue-on-error: true
run: |
mkdir -p /tmp/latest
bunx npm pack `@elizaos/plugin-n8n-workflow`@latest --pack-destination /tmp
tar xzf /tmp/elizaos-plugin-n8n-workflow-*.tgz -C /tmp/latestThen in the compare step, treat a download failure as "changed": - name: Compare with latest release
id: compare
run: |
+ if [ "${{ steps.download.outcome }}" = "failure" ]; then
+ echo "No previous release found — treating as changed"
+ echo "changed=true" >> $GITHUB_OUTPUT
+ exit 0
+ fi
CHANGED=false🤖 Prompt for AI Agents |
||
|
|
||
| - name: Compare with latest release | ||
| id: compare | ||
| run: | | ||
| CHANGED=false | ||
|
|
||
| for file in defaultNodes.json schemaIndex.json triggerSchemaIndex.json; do | ||
| NEW="dist/data/$file" | ||
| OLD="/tmp/latest/package/dist/data/$file" | ||
|
|
||
| if [ ! -f "$NEW" ]; then | ||
| continue | ||
| fi | ||
|
Comment on lines
+42
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing local artifact skipped silently — may mask build failures. If 🤖 Prompt for AI Agents |
||
|
|
||
| if [ ! -f "$OLD" ]; then | ||
| echo "$file: NEW file (not in latest release)" | ||
| CHANGED=true | ||
| continue | ||
| fi | ||
|
|
||
| if ! diff <(jq -S . "$NEW") <(jq -S . "$OLD") > /dev/null 2>&1; then | ||
| echo "$file: CHANGED" | ||
| CHANGED=true | ||
| else | ||
| echo "$file: unchanged" | ||
| fi | ||
| done | ||
|
|
||
| echo "changed=$CHANGED" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Bump version | ||
| if: steps.compare.outputs.changed == 'true' | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| npm version patch --no-git-tag-version | ||
| VERSION=$(jq -r .version package.json) | ||
| git add package.json | ||
| git commit -m "chore: bump to v${VERSION} (schema update)" | ||
| git push | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security concern: This workflow automatically pushes version bumps to main without creating a PR for review. Risk: Schema changes could introduce breaking changes that bypass code review. Recommendation: Instead of auto-pushing, create a PR: - name: Create PR for schema update
if: steps.compare.outputs.changed == 'true'
run: |
git checkout -b schema-update-$(date +%Y%m%d)
git add package.json dist/data/
git commit -m "chore: update schemas (automated)"
git push origin schema-update-$(date +%Y%m%d)
gh pr create --title "chore: update schemas" --body "Automated schema update from scheduled job" |
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Trigger publish | ||
| if: steps.compare.outputs.changed == 'true' | ||
| run: gh workflow run npm-deploy.yml | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
Uh oh!
There was an error while loading. Please reload this page.