-
Notifications
You must be signed in to change notification settings - Fork 928
docs: refactor CI setup example of GitHub Actions #4439
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 all commits
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 |
---|---|---|
|
@@ -15,30 +15,29 @@ name: CI | |
|
||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install required dependencies | ||
run: | | ||
apt update | ||
apt install -y sudo | ||
sudo apt install -y git curl | ||
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - | ||
sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- name: Install commitlint | ||
run: npm install -D @commitlint/cli @commitlint/config-conventional | ||
- name: Print versions | ||
run: | | ||
git --version | ||
node --version | ||
npm --version | ||
npx commitlint --version | ||
- name: Install commitlint | ||
run: | | ||
npm install conventional-changelog-conventionalcommits | ||
npm install commitlint@latest | ||
Comment on lines
+33
to
-41
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, move the install commitlint step for printing versions. |
||
|
||
- name: Validate current commit (last commit) with commitlint | ||
if: github.event_name == 'push' | ||
|
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.
If a GitHub Actions job or workflow has no explicit permissions set, then the repository permissions are used. Repositories created under organizations inherit the organization permissions. The organizations or repositories created before February 2023 have the default permissions set to read-write. Often these permissions do not adhere to the principle of least privilege and can be reduced to read-only, leaving the
write
permission only to a specific types asissues: write
orpull-requests: write
.References