-
Notifications
You must be signed in to change notification settings - Fork 3
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
Throw when values are updated in CI #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my Mac and in a bash environment, this works flawlessly and has great validation steps and testing. Nice work!
Some comments within to discuss.
Here and elsewhere, I suspect we've strayed from official cross-platform support. It breaks in cmd
and Powershell
. I don't know if we care to make that supported - but the creeping in of these assumptions should be noted in my opinion.
@@ -23,3 +23,6 @@ jobs: | |||
|
|||
- name: Build | |||
run: npm run build | |||
|
|||
- name: Check Markdown Docs | |||
run: npm run markdown-inject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love this is an integration test - it looks to small to be useful but really it is!
@@ -16,7 +16,7 @@ | |||
"clean": "rm -rf dist", | |||
"lint": "eslint .", | |||
"test": "jest", | |||
"prepare": "husky install", | |||
"prepare": "husky install && ( [ \"$CI\" = 'true' ] || npm run build )", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closing this - it's really stale and we've changed a few things since |
closes #6
Features
CI-Aware
markdown-inject
is now CI-aware! It will exits with code 1 without writing new blocks whenCI=true
and block changes exist. This behavior can be bypassed with the--force-write
(-f
) flag. I've added a CI step to perform this validation internally.Prepare:
build
The
build
npm script now occurs onprepare
for lazier local development. This is / can be bypassed withCI=true
, meaning a CI build step that is separate from the install step is still necessary. This is intentional to ease isolating CI-time build failures.Validation
Automated
I've added a
Check Markdown Docs
step to CI, which you can observe (intentionally) failing here:https://github.com/target/markdown-inject/runs/3906606163
Also, note that no
build
occurs during theInstall Dependencies
step.Manual
Due to the addition to the
prepare
script, installing dependencies will now cause a build to occur:Result
Alternatively, setting
CI=true
will prevent this build:Result
Let's write a junk markdown block to validate some things:
Result
Let's make sure we can still write markdown normally:
Result
Now, let's re-write the empty block and try to write it with
CI=true
. The failure is expected, and the error text indicates that (1) block changes do not occur; (2) block changes are prohibited in CI; and (3) this can be bypassed with the--force-write
CLI flag.Result
Let's put that CLI flag to the test:
Result