File tree 2 files changed +29
-1
lines changed
coderd/database/migrations
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -900,6 +900,7 @@ jobs:
900
900
- test-e2e
901
901
- offlinedocs
902
902
- sqlc-vet
903
+ - check-migration-numbers
903
904
# Allow this job to run even if the needed jobs fail, are skipped or
904
905
# cancelled.
905
906
if : always()
@@ -1329,6 +1330,33 @@ jobs:
1329
1330
run : |
1330
1331
make sqlc-vet
1331
1332
1333
+ check-migration-numbers :
1334
+ runs-on : ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
1335
+ if : github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
1336
+ steps :
1337
+ - name : Harden Runner
1338
+ uses : step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
1339
+ with :
1340
+ egress-policy : audit
1341
+
1342
+ - name : Checkout
1343
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1344
+ with :
1345
+ fetch-depth : 0 # Need full history for the script to work correctly
1346
+
1347
+ - name : Run migration number fixer script
1348
+ run : |
1349
+ ./coderd/database/migrations/fix_migration_numbers.sh
1350
+
1351
+ - name : Check for unstaged changes
1352
+ run : |
1353
+ if [[ -n "$(git status --porcelain)" ]]; then
1354
+ echo "ERROR: Migration numbering is incorrect. The fix_migration_numbers.sh script made changes."
1355
+ echo "Please run './coderd/database/migrations/fix_migration_numbers.sh' locally and commit the changes."
1356
+ git diff
1357
+ exit 1
1358
+ fi
1359
+
1332
1360
notify-slack-on-failure :
1333
1361
needs :
1334
1362
- required
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ list_migrations() {
11
11
main () {
12
12
cd " ${SCRIPT_DIR} "
13
13
14
- origin=$( git remote -v | grep " github.com[:/]coder/coder.*(fetch)" | cut -f1)
14
+ origin=$( git remote -v | grep " github.com[:/]* coder/coder.*(fetch)" | cut -f1)
15
15
16
16
echo " Fetching ${origin} /main..."
17
17
git fetch -u " ${origin} " main
You can’t perform that action at this time.
0 commit comments