File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Commit Changes
2+
3+ on :
4+ workflow_dispatch :
5+
6+ jobs :
7+ build-and-commit :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - name : Checkout code
12+ uses : actions/checkout@v3
13+
14+ - name : Set up Node.js environment
15+ uses : actions/setup-node@v2
16+ with :
17+ node-version : ' 14'
18+
19+ - name : Build project using Webpack/Rollup
20+ run : |
21+ npm i
22+ npm run build
23+
24+ - name : Commit and push changes
25+ run : |
26+ git config --global user.name "GitHub Actions"
27+ git config --global user.email "actions@github.com"
28+ git add -A
29+ git reset -- node_modules # Unstage the node_modules changes
30+ if ! git diff --cached --quiet; then
31+ git diff --cached --name-only | while read -r file; do
32+ commit_message="Updated $file :inbox_tray:"
33+ git commit -m "$commit_message" -- "$file"
34+ done
35+
36+ git push
37+ else
38+ echo "No changes to commit."
39+ fi
You can’t perform that action at this time.
0 commit comments