mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 18:27:19 +00:00
Update update-be-new-migration-latest-timestamp.yml
This commit is contained in:
@@ -2,8 +2,7 @@ name: Rename Migrations
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types: [closed]
|
||||||
- closed
|
|
||||||
paths:
|
paths:
|
||||||
- 'backend/src/db/migrations/**'
|
- 'backend/src/db/migrations/**'
|
||||||
|
|
||||||
@@ -11,30 +10,39 @@ jobs:
|
|||||||
rename:
|
rename:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- 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
|
||||||
- name: Script to rename migrations
|
if [ ! -s added_files.txt ]; then
|
||||||
|
echo "No new files added. Skipping"
|
||||||
|
echo "SKIP_RENAME=true" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Script to rename migrations
|
||||||
|
if: env.SKIP_RENAME != 'true'
|
||||||
run: python .github/resources/rename_migration_files.py
|
run: python .github/resources/rename_migration_files.py
|
||||||
|
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
|
if: env.SKIP_RENAME != 'true'
|
||||||
run: |
|
run: |
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
git config user.email [email protected]
|
git config user.email [email protected]
|
||||||
git add ./backend/src/db/migrations
|
git add ./backend/src/db/migrations
|
||||||
rm added_files.txt
|
rm added_files.txt
|
||||||
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)"
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
|
if: env.SKIP_RENAME != 'true'
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
commit-message: 'chore: renamed new migration files to latest UTC(gh-action)'
|
commit-message: 'chore: renamed new migration files to latest UTC (gh-action)'
|
||||||
title: 'GH Action: rename new migration file timestamp'
|
title: 'GH Action: rename new migration file timestamp'
|
||||||
branch-suffix: timestamp
|
branch-suffix: timestamp
|
||||||
|
|||||||
Reference in New Issue
Block a user