mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
chore: updated rename migration action to run on PR merge
This commit is contained in:
@@ -2,27 +2,19 @@ name: Rename Migrations
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
paths:
|
paths:
|
||||||
- 'backend/src/db/migrations/**'
|
- 'backend/src/db/migrations/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rename:
|
rename:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event.pull_request.merged == true
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install GH CLI - Local Testing Using Nektos Act
|
|
||||||
if: ${{ env.ACT }}
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install gh
|
|
||||||
|
|
||||||
- name: Checkout PR
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: gh pr checkout ${{ github.event.pull_request.number }}
|
|
||||||
|
|
||||||
- name: Get list of newly added files in migration folder
|
- name: Get list of newly added files in migration folder
|
||||||
run: git diff --name-status HEAD^ HEAD backend/src/db/migrations | grep '^A' | cut -f2 | xargs -n1 basename > added_files.txt
|
run: git diff --name-status HEAD^ HEAD backend/src/db/migrations | grep '^A' | cut -f2 | xargs -n1 basename > added_files.txt
|
||||||
|
|
||||||
@@ -35,5 +27,10 @@ jobs:
|
|||||||
git config user.email github-actions@github.com
|
git config user.email github-actions@github.com
|
||||||
git add ./backend/src/db/migrations
|
git add ./backend/src/db/migrations
|
||||||
git commit -m "chore: renamed new migration files to latest timestamp (gh-action)"
|
git commit -m "chore: renamed new migration files to latest timestamp (gh-action)"
|
||||||
git push
|
|
||||||
|
- name: Push changes
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
|
||||||
|
run: |
|
||||||
|
git push https://$GITHUB_ACTOR:$TOKEN@github.com/${{ github.repository }}.git HEAD:main
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user