File tree 1 file changed +39
-35
lines changed
1 file changed +39
-35
lines changed Original file line number Diff line number Diff line change @@ -70,52 +70,56 @@ script:
70
70
It's just a simple example of how CircleCI configuration file could look like to validate last commit message
71
71
72
72
` ` ` yml
73
- version : 2
74
- defaults :
75
- working_directory : ~/project
76
- docker :
77
- - image : circleci/node:latest
73
+ version : 2.1
74
+
75
+ executors :
76
+ my-executor :
77
+ docker :
78
+ - image : cimg/node:current
79
+ working_directory : ~/project
78
80
79
81
jobs :
80
82
setup :
81
- << : *defaults
83
+ executor : my-executor
82
84
steps :
83
- - checkout
84
- - restore_cache :
85
- key : lock-{{ checksum "package-lock.json" }}
86
- - run :
87
- name : Install dependencies
88
- command : npm install
89
- - save_cache :
90
- key : lock-{{ checksum "package-lock.json" }}
91
- paths :
92
- - node_modules
93
- - persist_to_workspace :
94
- root : ~/project
95
- paths :
96
- - node_modules
85
+ - checkout
86
+ - restore_cache :
87
+ key : lock-{{ checksum "package-lock.json" }}
88
+ - run :
89
+ name : Install dependencies
90
+ command : npm install
91
+ - save_cache :
92
+ key : lock-{{ checksum "package-lock.json" }}
93
+ paths :
94
+ - node_modules
95
+ - persist_to_workspace :
96
+ root : ~/project
97
+ paths :
98
+ - node_modules
97
99
98
100
lint_commit_message :
99
- << : *defaults
101
+ executor : my-executor
100
102
steps :
101
- - checkout
102
- - attach_workspace :
103
- at : ~/project
104
- - run :
105
- name : Define environment variable with latest commit's message
106
- command : |
107
- echo 'export COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")' >> $BASH_ENV
108
- source $BASH_ENV
109
- - run :
110
- name : Lint commit message
111
- command : echo "$COMMIT_MESSAGE" | npx commitlint
103
+ - checkout
104
+ - attach_workspace :
105
+ at : ~/project
106
+ - run :
107
+ name : Define environment variable with latest commit's message
108
+ command : |
109
+ echo 'export COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")' >> $BASH_ENV
110
+ source $BASH_ENV
111
+ - run :
112
+ name : Lint commit message
113
+ command : echo "$COMMIT_MESSAGE" | npx commitlint
112
114
113
115
workflows :
114
- version : 2
116
+ version : 2.1
115
117
commit :
116
118
jobs :
117
- - setup
118
- - lint_commit_message : { requires: [setup] }
119
+ - setup
120
+ - lint_commit_message :
121
+ requires :
122
+ - setup
119
123
` ` `
120
124
121
125
## GitLab CI
You can’t perform that action at this time.
0 commit comments