Skip to content

Commit

Permalink
Merge pull request #21 from chkfung/ncc-automate-2
Browse files Browse the repository at this point in the history
Ncc automate to manual trigger
  • Loading branch information
chkfung authored Apr 4, 2024
2 parents 71d1c90 + 6940fdf commit 3eb4672
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/automate_ncc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build with ncc

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build:
Expand All @@ -18,10 +16,21 @@ jobs:
- name: Build with ncc
run: npx @vercel/ncc build index.js -o dist

- name: Commit and push if changed
- name: Create new branch and commit changes
id: create_branch
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
BRANCH_NAME=automated-build-$(date +'%Y%m%d%H%M%S')
git checkout -b $BRANCH_NAME
git add dist/index.js
git diff --quiet && git diff --staged --quiet || git commit -m "Automated build"
git push
git commit -m "Automated build"
git push origin $BRANCH_NAME
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: Automated build
body: This is an automated build.
branch: ${{ env.BRANCH_NAME }}

0 comments on commit 3eb4672

Please sign in to comment.