-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (37 loc) · 1.26 KB
/
staging-migrations.yaml
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
38
39
40
41
42
43
44
45
name: Apply staging migrations on PR when there are changes in the migrations folder
on:
pull_request:
types: [opened, synchronize]
jobs:
check-folder-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes in migrations folder
id: check_changes
run: |
git fetch origin main
git fetch origin ${{ github.head_ref || github.ref_name }}
git checkout ${{ github.head_ref || github.ref_name }}
if git diff --quiet origin/main HEAD -- migrations; then
echo "CHANGES='false'" >> $GITHUB_ENV
else
echo "CHANGES='true'" >> $GITHUB_ENV
fi
# echo the changes variable just to be sure
- name: Echo changes variable
run: echo "${{ env.CHANGES == 'true' }}"
- name: Set up Node.js
if: ${{ env.CHANGES == 'true' }}
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
if: ${{ env.CHANGES == 'true' }}
run: npm install --force
- name: Run TypeScript script
if: ${{ env.CHANGES == 'true' }}
run: npm run migrations:apply-staging