Skip to content

Commit

Permalink
Improved PR actions and related husky changes
Browse files Browse the repository at this point in the history
  • Loading branch information
schaier-io authored Mar 3, 2025
2 parents e535283 + a9af206 commit 18258de
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 53 deletions.
60 changes: 10 additions & 50 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissions:

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -38,61 +39,20 @@ jobs:
- name: Run Open API Generator
run: npm run swagger-json

- name: Install Frontend Dependencies
run: cd frontend && npm install

- name: Generate OpenAPI Types
run: cd frontend && npm run openapi-ts-latest

- name: Run Next Build
run: cd frontend && npm run build

lint:
name: Auto-Fix Lint Issues, Generate Swagger JSON and Push to PR and Comment
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Generate Prisma Client
run: npm run prisma:generate

- name: Run Format
run: npm run format

- name: Generate OpenAPI Types
id: openapi_types
run: |
npm run swagger-json
- name: Run ESLint for issues
id: lint_fix_remaining
run: |
npx eslint --fix --config eslint.config.mjs > lint-results.txt || true
- name: Check Lint Results File
run: |
if [ ! -s lint-results.txt ]; then echo "No lint issues found." > lint-results.txt; fi
if [ -s lint-results.txt ]; then echo "Lint issues found. Please fix them." && exit 1; fi
- name: Comment Remaining Lint Issues
if: ${{ github.event_name == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728
with:
header: Linter Report
path: lint-results.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Frontend Dependencies
run: cd frontend && npm install

- name: Generate OpenAPI Types
run: cd frontend && npm run openapi-ts-latest

- name: Run Next Build
run: cd frontend && npm run build
21 changes: 21 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,25 @@ if ! npm outdated --json >/dev/null 2>&1; then
# Note: We don't exit here as this is informational
fi

# Generate Swagger documentation
echo "${BLUE}πŸ” Generating Swagger documentation...${NC}"
if ! npm run swagger-json; then
echo "${RED}❌ Swagger documentation generation failed. Please fix any API documentation issues and try again.${NC}"
exit 6
fi

# Generate types
echo "${BLUE}πŸ” Generating types...${NC}"
if ! cd frontend && npm run openapi-ts-latest; then
echo "${RED}❌ Type generation for the frontend failed. Please fix errors and try again.${NC}"
exit 7
fi

# TypeScript build check
echo "${BLUE}πŸ” Running Frontend TypeScript compilation check...${NC}"
if ! cd frontend && npm run build; then
echo "${RED}❌ TypeScript frontend compilation failed. Please fix type errors and try again.${NC}"
exit 8
fi

echo "${GREEN}βœ… All pre-push checks completed!${NC}"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ ADMIN_KEY="abcdef_this_should_be_very_secure"
BLOCKFROST_API_KEY_PREPROD="your_blockfrost_api_key"
```

or
*optionally for mainnet add or replace `BLOCKFROST_API_KEY_PREPROD`

```sh
BLOCKFROST_API_KEY_MAINNET="your_blockfrost_api_key"
BLOCKFROST_API_KEY_MAINNET="your_blockfrost_api_key_for_mainnet"
```

if you want to run ont the mainnet. We recommend you to start on Preprod first.
if you want to run on mainnet. We recommend you to start on Preprod first.

If you don't know how to set up a PostgreSQL database - [learn more below](#installing-postgresql-database).

Expand Down

0 comments on commit 18258de

Please sign in to comment.