Merge pull request #7 from woaitsAryan/master #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continous integration | |
on: [push, pull_request] | |
jobs: | |
build_and_lint: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install commitlint | |
run: | | |
npm i -g @commitlint/config-conventional @commitlint/cli | |
- name: Install dependancies and build | |
run: | | |
if [ -f package.json ]; then | |
npm ci | |
npm run build | |
else | |
echo "package.json not found, skipping build step" | |
fi | |
shell: bash | |
- name: Validate commit messages | |
if: github.event_name == 'push' | |
run: | | |
commitlint -x @commitlint/config-conventional --from HEAD~1 --to HEAD --verbose | |
- name: Validate PR commits with commitlint | |
if: github.event_name == 'pull_request' | |
run: commitlint -x @commitlint/config-conventional --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose |