Skip to content
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(commitlint): check for the presence of concrete PR number #15

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Check commit message compliance of the pull request
if: github.event_name == 'pull_request'
run: |
./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }}
./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}

lint-shellcheck:
runs-on: ubuntu-20.04
Expand Down
7 changes: 4 additions & 3 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ set -o nounset
check_commitlint () {
from=${2:-master}
to=${3:-HEAD}
pr=${4:-[0-9]+}
npx commitlint --from="$from" --to="$to"
found=0
while IFS= read -r line; do
if echo "$line" | grep -qP "\(\#[0-9]+\)$"; then
if echo "$line" | grep -qP "\(\#$pr\)$"; then
true
else
echo "✖ PR number missing in $line"
echo "✖ Headline does not end by '(#$pr)' PR number: $line"
found=1
fi
done < <(git log "$from..$to" --format="%s")
Expand All @@ -28,7 +29,7 @@ check_commitlint () {
}

check_shellcheck () {
find . -name "*.sh" -exec shellcheck {} \;
find . -name "*.sh" -exec shellcheck {} \+
}

check_all () {
Expand Down
12 changes: 6 additions & 6 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/zsh
#!/usr/bin/env bash

# This script uses standalone Docker. Run it as follows:
#
Expand All @@ -8,16 +8,16 @@
#
# $ root results.root


# shellcheck disable=SC1091
source /opt/cms/cmsset_default.sh
scramv1 project CMSSW CMSSW_5_3_32
cd CMSSW_5_3_32/src
eval `scramv1 runtime -sh`
cd CMSSW_5_3_32/src || exit
eval "$(scramv1 runtime -sh)"
cd ../..
mkdir reana-demo-cms-dimuon-mass-spectrum
cd reana-demo-cms-dimuon-mass-spectrum
cd reana-demo-cms-dimuon-mass-spectrum || exit
mkdir DimuonSpectrum2011
cd DimuonSpectrum2011
cd DimuonSpectrum2011 || exit
cp -a /w/* .
scram b
cmsRun ./demoanalyzer_cfg.py
Expand Down
Loading