-
Notifications
You must be signed in to change notification settings - Fork 13
37 lines (35 loc) · 1.31 KB
/
test-pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Validate Pull Request
on: pull_request
jobs:
build:
runs-on: ubuntu-22.04
env:
TARGET_BRANCH: 'build'
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Copy build artifacts to the target branch
run: |
git fetch # fetch branches
git checkout ${TARGET_BRANCH} # checkout to your branch
git merge origin/main --no-edit # merge the main branch to your branch
cp -r dist/* storefront # move all files from dist to storeferont
- name: Commit changes
run: |
git config --global user.name 'devops-devdocs' # set your username
git config --global user.email '[email protected]' # set your email
git add --all # add all changed files
git diff-index --quiet HEAD || git commit -am "$(git rev-parse --short $GITHUB_SHA): deploy files" # commit to the repository (ignore if no modification)
git push --dry-run origin ${TARGET_BRANCH} # check pushing to the remote target branch in a dry run mode