Skip to content

Commit

Permalink
Add pre-commit to check app name registered or not
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaranvpl committed Nov 15, 2024
1 parent a95b5b1 commit e0a0402
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@ repos:
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]

- repo: local
hooks:
- id: check-registered-app
name: Check if the app name is registered in fly.io
entry: "scripts/check-registered-app-pre-commit.sh"
language: python
types: [python]
require_serial: true
verbose: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# taken from: https://jaredkhan.com/blog/mypy-pre-commit

# A script for running mypy,
# with all its dependencies installed.

set -o errexit

# Change directory to the project root directory.
cd "$(dirname "$0")"/..

./scripts/check-registered-app.sh
8 changes: 8 additions & 0 deletions {{cookiecutter.project_slug}}/scripts/check-registered-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Check file registered_app_domain.txt exists. If it does not exists, echo and exit.
if [ ! -f registered_app_domain.txt ]; then
echo -e "\033[0;33mWarning: App name is not registered.\033[0m"
echo -e "\033[0;33mGithub Actions may fail if you push without registering.\033[0m"
echo -e "\033[0;33mRegister your app name by running the script 'scripts/register_to_fly_io.sh'.\033[0m"
fi

0 comments on commit e0a0402

Please sign in to comment.