File tree 3 files changed +64
-0
lines changed
3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build
2
+ on :
3
+ pull_request :
4
+ branches :
5
+ - main
6
+ jobs :
7
+ build :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - name : Checkout code
11
+ uses : actions/checkout@v2
12
+
13
+ - name : Set up Node.js
14
+ uses : actions/setup-node@v2
15
+ with :
16
+ node-version : ' 20'
17
+
18
+ - name : Install dependencies
19
+ run : npm install
20
+
21
+ - name : Run Build
22
+ run : npm run build
Original file line number Diff line number Diff line change
1
+ name : Auto Comment on PRs
2
+ on :
3
+ pull_request :
4
+ types : [opened]
5
+ jobs :
6
+ auto-comment :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - name : Checkout PR branch
10
+ uses : actions/checkout@v3
11
+ with :
12
+ fetch-depth : 0 # Necessary to access the full history and base branch
13
+
14
+ - name : Check package.json version
15
+ id : version-check
16
+ run : |
17
+ # Extract the current version from the PR's package.json
18
+ CURRENT_VERSION=$(jq -r .version package.json)
19
+ echo "Current version: $CURRENT_VERSION"
20
+
21
+ # Fetch the version from the base branch's package.json
22
+ BASE_VERSION=$(git show origin/${{ github.base_ref }}:package.json | jq -r .version)
23
+ echo "Base branch version: $BASE_VERSION"
24
+
25
+ if [ "$CURRENT_VERSION" = "$BASE_VERSION" ]; then
26
+ echo "No version change detected."
27
+ echo "versionChanged=false" >> $GITHUB_OUTPUT
28
+ else
29
+ echo "Version change detected."
30
+ echo "versionChanged=true" >> $GITHUB_OUTPUT
31
+ fi
32
+
33
+ - name : Auto Comment if version not changed
34
+ if : steps.version-check.outputs.versionChanged == 'false'
35
+ uses : wow-actions/auto-comment@v1
36
+ with :
37
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38
+ pullRequestOpened : |
39
+ Thanks for contributing!
40
+ It looks like you haven't updated this package's version in package.json.
41
+ Please update the package version according to semantic versioning guidelines.
Original file line number Diff line number Diff line change
1
+ lts/iron
You can’t perform that action at this time.
0 commit comments