-
Notifications
You must be signed in to change notification settings - Fork 45
46 lines (39 loc) · 1.39 KB
/
db-version.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
38
39
40
41
42
43
44
45
46
---
name: DB Version Management
on:
workflow_dispatch:
workflow_call:
jobs:
update-db-version:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'bump_db')
steps:
- uses: actions/checkout@v3
- name: Install yq
run: sudo apt-get install -y yq
- name: Check if PR already bumped
id: check_bump
run: |
PR_NUM="${{ github.event.pull_request.number }}"
if yq -e ".versions[] | select(.pr == ${PR_NUM})" .db-versions.yml > /dev/null 2>&1; then
echo "already_bumped=true" >> $GITHUB_OUTPUT
else
echo "already_bumped=false" >> $GITHUB_OUTPUT
fi
- name: Configure Git
if: steps.check_bump.outputs.already_bumped == 'false'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Update DB Version
if: steps.check_bump.outputs.already_bumped == 'false'
run: |
./scripts/update-db-version.sh "${{ github.event.pull_request.number }}"
- name: Commit and Push
if: steps.check_bump.outputs.already_bumped == 'false'
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git add .db-versions.toml
git commit -m "chore: bump db version"
git push origin HEAD
fi