feat: release suggest groups #569
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Migration Order | |
on: | |
pull_request: | |
paths: | |
- packages/server/postgres/migrations/*.ts | |
jobs: | |
migration-order: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Get newest migration on master | |
run: | | |
MAX_OLD_MIGRATION=$(ls packages/server/postgres/migrations | tail -n 1) | |
echo MAX_OLD_MIGRATION=$MAX_OLD_MIGRATION >> $GITHUB_ENV | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
- name: Get new migrations | |
id: new-migrations | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: packages/server/postgres/migrations/*.ts | |
output_renamed_files_as_deleted_and_added: "true" | |
- name: Check migration conflicts and renamed or deleted files | |
run: | | |
for file in ${{ steps.new-migrations.outputs.added_files }}; do | |
FILE_NAME=$(basename $file) | |
if [[ "$FILE_NAME" < "${{ env.MAX_OLD_MIGRATION }}" ]]; then | |
echo "$FILE_NAME predates ${{ env.MAX_OLD_MIGRATION}}. Please rename it" | |
exit 1 | |
else | |
echo "$FILE_NAME does not conflict with existing migrations on master" | |
fi | |
done | |
if ${{ steps.new-migrations.outputs.any_deleted }}; then | |
echo "${{ steps.new-migrations.outputs.deleted_files_count }} migration files where renamed or deleted. Please put their original names back or restore the following files:" | |
for file in ${{ steps.new-migrations.outputs.deleted_files }}; do | |
echo $(basename $file) | |
done | |
exit 1 | |
fi |