Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,29 @@ jobs:
# if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install

# 5. Build only if build artifacts aren't cached
# 5. Check codegen is up to date
- name: Check codegen is up to date
run: |
echo "Running codegen to check if outputs are current..."
yarn generate

echo "Checking if codegen outputs changed..."
if ! git diff --exit-code src/generated/; then
echo "❌ Codegen outputs are outdated!"
echo "The following files have changes:"
git diff --name-only src/generated/
echo ""
echo "Please run 'yarn generate' locally and commit the changes."
exit 1
fi

echo "✅ Codegen outputs are up to date"

# 6. Build only if build artifacts aren't cached
- name: Build
run: yarn build

# 6. Run tests
# 7. Run tests
- name: Run tests
run: yarn test

Expand Down
26 changes: 26 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# Get list of staged files before running formatter/linter
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)

# Check if any GraphQL queries or schema-related files are being committed
GRAPHQL_FILES=$(echo "$STAGED_FILES" | grep -E '\.(graphql|gql)$' || true)
SCHEMA_RELATED_FILES=$(echo "$STAGED_FILES" | grep -E '(codegen\.ts|wagmi\.config\.ts)$' || true)

# If GraphQL or schema files are being committed, check codegen
if [ -n "$GRAPHQL_FILES" ] || [ -n "$SCHEMA_RELATED_FILES" ]; then
echo "🔍 GraphQL or schema files detected, checking codegen..."

# Run codegen
yarn generate

# Check if codegen outputs changed
if ! git diff --exit-code src/generated/; then
echo "⚠️ Codegen outputs have changed!"
echo "The following files were updated:"
git diff --name-only src/generated/
echo ""
echo "These changes will be automatically staged for commit."

# Stage the generated files
git add src/generated/
else
echo "✅ Codegen outputs are up to date"
fi
fi

# Run format and lint
yarn format-and-lint

Expand Down
1 change: 1 addition & 0 deletions src/generated/contractHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19581,3 +19581,4 @@ export const useWatchTractorHelpers_OperatorReward =
address: tractorHelpersAddress,
eventName: 'OperatorReward',
})
// manual change to test CI failure
Loading