Automated workflows for continuous integration, deployment, and quality assurance.
Located in .github/workflows/
Purpose: Main CI pipeline for code quality and testing
Triggers:
- Push to
mainanddevelopbranches - Pull requests to
mainanddevelop
Jobs:
- Type Check - TypeScript type checking with smart contract compilation
- Test - Run unit tests with coverage reporting
- Build - Build production artifacts
Environment: Node.js 20.x with pnpm
Purpose: Additional checks for pull requests
Triggers:
- Pull request opened, synchronized, reopened, labeled, or unlabeled
Jobs:
- Labeler - Auto-label PRs based on changed files
- Size Check - Warn on large PRs (>1000 lines)
Purpose: Security scanning and vulnerability detection
Triggers:
- Push to
main - Pull requests to
main - Scheduled (weekly on Sunday)
Jobs:
- Dependency Audit - Run pnpm audit for vulnerable dependencies
- Secrets Scan - TruffleHog OSS for exposed secrets
Tools:
- pnpm audit
- TruffleHog
Purpose: Comprehensive code quality and security linting
Triggers:
- Push to
mainanddevelopbranches - Pull requests to
mainanddevelop
Jobs:
- Run MegaLinter with enabled linters
- Upload MegaLinter reports as artifacts
Linters Enabled:
- TypeScript ESLint
- JSON Lint
- YAML Lint
- Markdown Lint
- Dockerfile Hadolint
- Solidity Solhint
Purpose: Smart contract compilation, testing, and security analysis
Triggers:
- Push to
mainanddevelopaffectingcontracts/orhardhat.config.cjs - Pull requests to
mainaffectingcontracts/orhardhat.config.cjs
Jobs:
- Compile and Test - Compile contracts and run Hardhat tests
- Slither - Static analysis for security vulnerabilities
Environment:
- Node.js 20.x with pnpm
- Hardhat
- Slither
Purpose: Build and push Docker images to Docker Hub
Triggers:
- Push to
mainbranch
Jobs:
- Build Docker image with Buildx
- Tag images (latest and commit SHA)
- Push to Docker Hub
- Run Trivy vulnerability scanner
Tags:
latest- Latest main branch<commit-sha>- Specific commit
Purpose: Deploy to Hugging Face Spaces
Triggers:
- Push to
mainbranch
Jobs:
- Checkout repository with LFS
- Push to Hugging Face Space repository
Environment: production (https://protechph-freelancexchain.hf.space)
Purpose: Automated release creation and Docker image publishing
Triggers:
- Push tags matching
v*
Jobs:
- Build production artifacts
- Generate changelog
- Create GitHub release with release notes
- Build and push versioned Docker image
- Run Trivy vulnerability scanner on image
Artifacts:
- GitHub release with changelog
- Docker image tagged with version
Configure these in GitHub Settings β Secrets:
| Secret | Description | Used In |
|---|---|---|
DOCKERHUB_USERNAME |
Docker Hub username | docker-hub.yml, release.yml |
DOCKERHUB_TOKEN |
Docker Hub access token | docker-hub.yml, release.yml |
HF_TOKEN |
Hugging Face access token | sync-huggingface.yml |
GITHUB_TOKEN |
GitHub token (auto-provided) | All workflows |
HF_TOKEN |
Hugging Face token | sync-huggingface.yml |
Set in workflow files or GitHub Environments:
env:
NODE_VERSION: '20.x'
BLOCKCHAIN_RPC_URL: 'https://sepolia.infura.io/v3/...'
DOCKER_IMAGE: 'freelancexchain/api'Add to README.md:



[](https://codecov.io/gh/username/repo)Use act to run workflows locally:
# Install act
brew install act # macOS
# or
choco install act # Windows
# Run CI workflow
act -j ci
# Run specific job
act -j test
# List available workflows
act -l# Install actionlint
brew install actionlint
# Validate all workflows
actionlint .github/workflows/*.yml- Run quick checks first (linting, type checking)
- Parallel jobs when possible
- Cache dependencies
- Never commit secrets
- Use GitHub Secrets
- Scan for vulnerabilities
- Verify dependencies
- Use specific action versions (not @latest)
- Add timeout limits
- Handle failures gracefully
- Retry flaky tests
- Cache node_modules
- Cache Docker layers
- Skip unnecessary jobs
- Use matrix builds
-
Create workflow file
touch .github/workflows/new-workflow.yml
-
Define workflow
name: New Workflow on: push: branches: [main] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Run task run: echo "Hello"
-
Test locally
act -j build
-
Commit and push
git add .github/workflows/new-workflow.yml git commit -m "Add new workflow" git push
- Check logs - View detailed logs in GitHub Actions tab
- Run locally - Use
actto reproduce - Check secrets - Verify all required secrets are set
- Review changes - Check recent commits for breaking changes
"Secret not found"
- Add secret in GitHub Settings β Secrets
"Permission denied"
- Check repository permissions
- Verify token scopes
"Timeout"
- Increase timeout in workflow
- Optimize slow steps
"Cache miss"
- Check cache key
- Verify cache paths
Defines code ownership for automatic PR reviewer assignment.
# Backend
/src/**/*.ts @backend-team
# Smart Contracts
/contracts/**/*.sol @blockchain-team
# Documentation
/docs/** @docs-team
Automated dependency updates.
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"Automatic PR labeling based on changed files.
backend:
- src/**/*
blockchain:
- contracts/**/*
documentation:
- docs/**/*- Success rate
- Average duration
- Failure patterns
- Resource usage
- Failed deployments
- Security vulnerabilities
- Test failures
- Performance degradation
For questions or issues with workflows, contact the DevOps team or open an issue.