-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[No QA] Schema Validation for Github Actions #2197
Conversation
Note that what this does not do is format linting of yaml files for things like indentation, brackets, etc... |
run: ./.github/scripts/verifyActions.sh | ||
|
||
- name: Validate actions and workflows | ||
run: npm run gh-actions-validate |
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.
I'm sure it's for consistency with the rest but why did we decide to proxy all our shell scripts with NPM actions ?
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.
It's so you can run them from any directory in the project and they will still work the same. Like it I were to do cd .github && ./scripts/validateActionsAndWorkflows.sh
, then the script would fail because it tries to run cd ./.github
and that would fail. But if you run it as an npm script then it's always running from the project root.
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.
Hmm, there are other ways to ensure that in Bash without requiring npm
. In this case, this we already use it that's probably fine but we shouldn't rely on it otherwise IMO.
E.g. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
Can you test? Or is this internal QA? |
Yeah, I can do some more testing in this PR pre-merge. But then I don't think any QA will be necessary because the PR is the environment in which this check is meant to run. |
All yours @Dal-Papa and @AndrewGable |
No changes since @Dal-Papa's last approval, only temporary changes for testing. So going to self-merge this one. |
cc'ing @Dal-Papa - maybe this will be useful for other repos too!
Details
Creates a script which validates the Github Actions and Workflows using the schemas provided by https://json.schemastore.org
These schema seem to be pretty actively maintained by the community here.
Uses a YAML validator called ajv, which also seems to be actively maintained.
Fixed Issues
Fixes (partial) https://github.com/Expensify/Expensify/issues/156436
Tests
Tested On