Skip to content

docs: fix github actions ci example #3892

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions docs/guides-ci-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@ jobs:
commitlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- 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: Print versions
run: |
git --version
node --version
npm --version
npx commitlint --version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@letsaguiar and why dont you like printing versions 😭 😅

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short answer: I don't think it's useful since we already know which version of git comes with Ubuntu 22.04 and which version of node we're installing

Long answer: an unnecessary step makes the pipeline slow and increase the cloud costs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those points apply to git and node, but not to the other 2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, your long answer is shorter than your short answer 😆

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the meaning is deeper haha

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to revert it :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good


- name: Install commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
run: npm install --global @commitlint/{cli,config-conventional}
Copy link
Contributor

@knocte knocte Feb 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@letsaguiar are you sure this syntax is correct? I've tried it myself in a repo of mine because I thought it would be nice to adopt it, and I'm getting this error:

Run npm install --global @commitlint/{cli,config-conventional}
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /__w/conventions/conventions/@commitlint/{cli,config-conventional}/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/__w/conventions/conventions/@commitlint/{cli,config-conventional}/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in: /github/home/.npm/_logs/202[4](https://github.com/knocte/conventions/actions/runs/7771223169/job/21192285282#step:6:5)-02-04T02_[5](https://github.com/knocte/conventions/actions/runs/7771223169/job/21192285282#step:6:6)[9](https://github.com/knocte/conventions/actions/runs/7771223169/job/21192285282#step:6:10)_54_919Z-debug-0.log
Error: Process completed with exit code 254.

(conventions is the name of my repo btw)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting thing is that the above syntax works when you're running your CI job without a container: attribute, but fails with the above message when using container: (a docker image). I have no idea why this happens. But this needs to be reverted from the PR in case the commitlint user reading the documentation is using container images instead of default github VMs.


- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
Expand Down