Skip to content

Commit 03e4bef

Browse files
authored
ci(dep): Add step to commit changes if PR has dependencies label (#108)
This commit is to perform below steps: - If PR is having dependencies label, update files in dist as well - If PR doesn't have dependencies label, fail the build if there is dirty changes. Closes #55 Signed-off-by: Tam Mach <[email protected]>
1 parent cdfc708 commit 03e4bef

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/test.yml

+21-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,31 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-go@v2
1514
- run: |
1615
npm install
1716
npm run all
1817
18+
# Update dist files if there is label dependencies
19+
- name: Update dist files
20+
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'dependencies')
21+
run: |
22+
if [[ -z $(git status -s) ]]
23+
then
24+
echo "No change is required"
25+
else
26+
echo "Updating dist directory"
27+
git config --local user.name "dependabot[bot]"
28+
git config --local user.email "49699333+dependabot[bot]@users.noreply.github.com"
29+
git add --update
30+
git commit --message="Update dist files"
31+
git push
32+
fi
33+
34+
# Fail the build if there is dirty change
35+
- run: git diff --exit-code
36+
1937
test: # make sure the action works on a clean machine without building
38+
needs: [ build ]
2039
strategy:
2140
matrix:
2241
os:
@@ -42,6 +61,7 @@ jobs:
4261
only-new-issues: true
4362

4463
test-go-mod-version:
64+
needs: [ build ]
4565
strategy:
4666
matrix:
4767
os:

0 commit comments

Comments
 (0)