Skip to content

Commit 31fb0bc

Browse files
F3n67uJounQin
andauthored
Use rules instead of only in README example (#177)
Co-authored-by: JounQin <[email protected]>
1 parent ae33d8a commit 31fb0bc

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ before_script: yarn --frozen-lockfile
7373
comment:
7474
image: node:lts-alpine
7575
stage: comment
76-
only: merge_requests
76+
rules:
77+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
7778
script: yarn changesets-gitlab comment # comment automatically like https://github.com/changesets/bot
7879

7980
release:
8081
image: node:lts-alpine
81-
only: main
82+
rules:
83+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
8284
script: yarn changesets-gitlab
8385
```
8486
@@ -96,12 +98,14 @@ before_script: yarn --frozen-lockfile
9698
comment:
9799
image: node:lts-alpine
98100
stage: comment
99-
only: merge_requests
101+
rules:
102+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
100103
script: yarn changesets-gitlab comment
101104
102105
release:
103106
image: node:lts-alpine
104-
only: main
107+
rules:
108+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
105109
script: yarn changesets-gitlab
106110
variables:
107111
INPUT_PUBLISH: yarn release
@@ -140,13 +144,14 @@ before_script: yarn --frozen-lockfile
140144
comment:
141145
image: node:lts-alpine
142146
stage: comment
143-
only:
144-
- merge_requests
147+
rules:
148+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
145149
script: yarn changesets-gitlab comment
146150
147151
release:
148152
image: node:lts-alpine
149-
only: main
153+
rules:
154+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
150155
script: yarn changesets-gitlab
151156
variables:
152157
INPUT_VERSION: yarn version
@@ -166,13 +171,14 @@ before_script: yarn --frozen-lockfile
166171
comment:
167172
image: node:lts-alpine
168173
stage: comment
169-
only:
170-
- merge_requests
174+
rules:
175+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
171176
script: yarn changesets-gitlab comment
172177
173178
release:
174179
image: node:lts-alpine
175-
only: main
180+
rules:
181+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
176182
script: yarn changesets-gitlab
177183
variables:
178184
INPUT_VERSION: yarn changeset version
@@ -183,7 +189,8 @@ You may also want to run `yarn install` after the `changeset verion` command to
183189
```yml
184190
release:
185191
image: node:lts-alpine
186-
only: main
192+
rules:
193+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
187194
script: yarn changesets-gitlab
188195
variables:
189196
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'

0 commit comments

Comments
 (0)