Skip to content

Commit 0d11c90

Browse files
authored
ci: add conventional checks for PR title and docs (#3054)
With this PR merged, new checks are introduced: the PR titles should follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/), which in the format of <type>(<scope>): <description>. e.g., - fix: Correct typo - feat(interactive): Add support for g.V().outE().inV() - refactor!: Drop support for Python 3.8 - feat(analytical): Add delta-version for PageRank if the PR is in type of `feat(<scope>):`, then documentation must be updated.
1 parent 4103150 commit 0d11c90

File tree

2 files changed

+123
-1
lines changed

2 files changed

+123
-1
lines changed

.github/workflows/pr-check.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: PR-Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
conventional-pr-check:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v3
14+
with:
15+
repository: ${{ github.event.pull_request.head.repo.full_name }}
16+
ref: ${{ github.event.pull_request.head.ref }}
17+
submodules: true
18+
fetch-depth: 0
19+
20+
- uses: amannn/action-semantic-pull-request@v5
21+
id: pr-convention
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
with:
25+
# Types allowed (newline-delimited).
26+
# Default: https://github.com/commitizen/conventional-commit-types
27+
types: |
28+
build
29+
ci
30+
docs
31+
feat
32+
fix
33+
perf
34+
refactor
35+
test
36+
chore
37+
# Scopes allowed (newline-delimited).
38+
scopes: |
39+
core
40+
python
41+
k8s
42+
coordinator
43+
one
44+
interactive
45+
insight
46+
analytical
47+
learning
48+
# A scope can be not provided.
49+
requireScope: false
50+
disallowScopes: |
51+
release
52+
[A-Z]+
53+
# If the PR contains one of these newline-delimited labels, the
54+
# validation is skipped.
55+
ignoreLabels: |
56+
bot
57+
ignore-semantic-pull-request
58+
59+
feature-docs-check:
60+
runs-on: ubuntu-20.04
61+
needs: conventional-pr-check
62+
steps:
63+
- uses: dorny/paths-filter@v2
64+
id: doc-changes
65+
with:
66+
filters: |
67+
src:
68+
- 'docs/**'
69+
70+
- uses: actions-ecosystem/action-regex-match@v2
71+
id: pr-regex-match
72+
with:
73+
text: ${{ github.event.pull_request.title }}
74+
regex: 'feat.*'
75+
76+
- if: ${{ steps.pr-regex-match.outputs.match != '' && steps.doc-changes.outputs.src == 'false' }}
77+
run: |
78+
# echo "title=${{ github.event.pull_request.title }}"
79+
# echo "steps.pr-regex-match.outputs.match=${{ steps.pr-regex-match.outputs.match }}"
80+
# echo "steps.doc-changes.outputs.src=${{ steps.doc-changes.outputs.src }}"
81+
echo " ❌ Uh oh! ❌ \n
82+
We suggest that a PR with type @feat should has corresponding documentations. \n
83+
If you believe this PR could be merged without documentation, please add @yecol as an extra reviewer for confirmation."
84+
exit 1

docs/development/how_to_contribute.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,45 @@ Follow [our code style guide](./code_style_guide.md) to attain the proper code f
109109

110110
### Submitting Your Changes
111111

112-
See [our guide on how to submit a pull request](./how_to_submit_pr.md).
112+
To submit your changes, you will need to open a pull request (PR) against the main repository. If you're new to GitHub, you can find instructions on how to do that in [GitHub's documentation](https://help.github.com/articles/creating-a-pull-request). GraphScope requires PR titles to follow a specific format (a.k.a., [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/)), depending on the type of change you're making. The format is as follows:
113+
114+
**type(scope): brief desciption about the pr**
115+
116+
Below are some examples of the valid PR titles:
117+
118+
- fix: Correct typo
119+
- feat(interactive): Add support for g.V().outE().inV()
120+
- refactor!: Drop support for Python 3.8
121+
- feat(analytical): Add delta-version for PageRank
122+
123+
````{note}
124+
Note that since pull request titles only have a single line, you have to use ! to indicate breaking changes.
125+
````
126+
127+
The **type** must be one of the following:
128+
129+
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
130+
- ci: Changes to our CI configuration files and scripts
131+
- docs: Documentation only changes
132+
- feat: A new feature
133+
- fix: A bug fix
134+
- perf: A code change that improves performance
135+
- refactor: A code change that neither fixes a bug nor adds a feature
136+
- test: Adding missing tests or correcting existing tests
137+
- chore: A routine task of development
138+
139+
The **scope** is optional. However, if it assigned, it must be one of the following:
140+
- core
141+
- python
142+
- k8s
143+
- coordinator
144+
- one
145+
- interactive
146+
- insight
147+
- analytical
148+
- learning
149+
150+
In addtion to the conventional commit specification, we also require the PRs with feature update, (i.e., titled with feat:) should update the corresponding documentations. The repo depolyed a CI check to ensure this.
113151

114152
### Discussing and Keeping Your Pull Request Updated
115153

0 commit comments

Comments
 (0)