-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
The goal here is to ensure that the snippets generated from a given file/directory are up-to-date with the source files they're generated from via CI/CD in a reusable way.
The action should accept the path for a file or directory and run bluehawk snip on it.
Then, it should compare the output of the snippets it created with those in the PR branch (e.g. with git diff or md5 hashing if we have to).
If the snippets are identical, the action succeeds.
Otherwise, the action fails and reports out-of-date snippets & source files in the GHA stdout.
name: Ensure Node.js Bluehawk Snippets Are Up To Date
on:
pull_request:
paths:
- "examples/node/**"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mongodb-university/bluehawk/github-actions/check-snip@main
with:
source: examples/node/Examples
output: source/examples/generated/nodeExample failure output:
Found 2 out-of-date snippets:
{ "source": "examples/node/Examples/mongodb.js", "snippet": "source/examples/generated/node/mongodb.snippet.find-a-single-document.js" }
{ "source": "examples/node/Examples/mongodb.js", "snippet": "source/examples/generated/node/mongodb.snippet.find-multiple-documents.js" }
To fix this, run:
npx bluehawk snip examples/node/Examples -o source/examples/generated/node
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status