Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a5d131

Browse files
committed
Add migration script checker to CI
Also fix slight regex bug on Bash 5Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent0c27f04 commit0a5d131

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

‎.github/workflows/ci.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ jobs:
900900
-test-e2e
901901
-offlinedocs
902902
-sqlc-vet
903+
-check-migration-numbers
903904
# Allow this job to run even if the needed jobs fail, are skipped or
904905
# cancelled.
905906
if:always()
@@ -1329,6 +1330,33 @@ jobs:
13291330
run:|
13301331
make sqlc-vet
13311332
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 status
1357+
exit 1
1358+
fi
1359+
13321360
notify-slack-on-failure:
13331361
needs:
13341362
-required

‎coderd/database/migrations/fix_migration_numbers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ list_migrations() {
1111
main() {
1212
cd"${SCRIPT_DIR}"
1313

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)
1515

1616
echo"Fetching${origin}/main..."
1717
git fetch -u"${origin}" main

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp