-
Notifications
You must be signed in to change notification settings - Fork 4
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
ci: replace commitlint action with our own implementation #1845
Conversation
size-limit report 📦
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #1845 +/- ##
==========================================
+ Coverage 92.50% 92.54% +0.03%
==========================================
Files 147 147
Lines 2776 2776
Branches 750 750
==========================================
+ Hits 2568 2569 +1
+ Misses 207 206 -1
Partials 1 1 ☔ View full report in Codecov by Sentry. |
5e9bf53
to
ba1ceae
Compare
7516775
to
482069b
Compare
- name: Validate commits commitlint | ||
# This workflow can also be triggered via "workflow_call". | ||
# Since it's a push event we have access to these properties https://docs.github.com/en/webhooks/webhook-events-and-payloads#push | ||
if: github.event_name == 'push' | ||
run: | | ||
COMMIT_COUNT=$(echo '${{ toJSON(github.event.commits) }}' | jq length) | ||
echo "Number of commits in the push: $COMMIT_COUNT" | ||
|
||
yarn commitlint --from HEAD~$COMMIT_COUNT --to HEAD --verbose |
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.
Credit to https://commitlint.js.org/#/guides-ci-setup?id=github-actions but I adjusted code to account for multiple commits being pushed up at once. Instead of using HEAD~1
we use HEAD~$COMMIT_COUNT
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.
LGTM. should we not use this provided action across the board now? anyone else using that?
# Since it's a push event we have access to these properties https://docs.github.com/en/webhooks/webhook-events-and-payloads#push | ||
if: github.event_name == 'push' | ||
run: | | ||
COMMIT_COUNT=$(echo '${{ toJSON(github.event.commits) }}' | jq length) |
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.
How/where does jq
get installed? Mostly out of curiousity...
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.
Great question! Github runners (the github hosted virtual machines we run workflows on) come with a set of preinstalled software. This can be seen looking at the logs of the github action. Here's the link in the image below for reference https://github.com/actions/runner-images/blob/ubuntu22/20240204.1/images/ubuntu/Ubuntu2204-Readme.md
I didn't check that, good idea. It doesn't look like the commitlint github action is being used much in the org. Only 3 repos (this repo, 1 archived repo, 1 other) |
Summary:
Our usage of
wagoid/commitlint-github-action@v5
is causing upgrade to commitlint 18.6.0 to fail (source: https://github.com/chanzuckerberg/edu-design-system/actions/runs/7847650438/job/21417042874?pr=1841). I'm updating the workflow to use own implementation that way we aren't held back from updating libraries.https://czi-tech.atlassian.net/browse/EFI-1617
Test Plan: