Skip to content

Add configurable debug logging for file filtering and workflow troubleshooting #84

Add configurable debug logging for file filtering and workflow troubleshooting

Add configurable debug logging for file filtering and workflow troubleshooting #84

Workflow file for this run

name: Test Fix-it Felix Action
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build action
run: npm run build
- name: Package action
run: npm run package
# Test functionality: Verify Felix detects formatting issues (dry run)
test-functionality:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create test files with intentional issues
run: |
mkdir temp-test
cat > temp-test/bad.js << 'EOF'
const x=1;
let y= 2 ;
console.log(x,y)
EOF
cat > temp-test/bad.md << 'EOF'
# Test File
This is a test file with some extra spaces.
And too many blank lines.
EOF
- name: Test Fix-it Felix functionality (dry run)
uses: ./
with:
fixers: 'prettier,markdownlint'
paths: 'temp-test'
dry_run: true
debug: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Check for uncommitted dist changes
check-dist:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check if dist is up to date
run: |
npm run build
if ! git diff --quiet dist/; then
echo "❌ dist/ folder is not up to date."
echo "📁 Files that changed:"
git diff --name-only dist/
echo ""
echo "🔧 To fix: run 'npm run build' and commit the changes."
exit 1
else
echo "✅ dist/ folder is up to date."
fi
# Check if we should skip dogfood to prevent infinite loops
check-dogfood-conditions:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
outputs:
should-run-dogfood: ${{ steps.check-author.outputs.should-run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if last commit is from Felix
id: check-author
run: |
LAST_AUTHOR=$(git log -1 --pretty=format:"%an")
echo "Last commit author: $LAST_AUTHOR"
# Check if last commit was by Felix or other bots
if [[ "$LAST_AUTHOR" == *"Fix-it Felix"* ]] || [[ "$LAST_AUTHOR" == *"felix"* ]] || [[ "$LAST_AUTHOR" == *"github-actions"* ]]; then
echo "should-run=false" >> $GITHUB_OUTPUT
echo "⚠️ Skipping dogfood - last commit was by bot: $LAST_AUTHOR"
else
echo "should-run=true" >> $GITHUB_OUTPUT
echo "✅ Will run dogfood - last commit was by human: $LAST_AUTHOR"
fi
# Dogfood: Actually fix formatting issues in this repo (real run)
dogfood:
runs-on: ubuntu-latest
needs: [test, test-functionality, check-dist, check-dogfood-conditions]
if: github.event_name == 'pull_request' && needs.check-dogfood-conditions.outputs.should-run-dogfood == 'true'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.FELIX_PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
# Note: Using FELIX_PAT (Personal Access Token) if available, otherwise GITHUB_TOKEN
# GitHub's GITHUB_TOKEN won't trigger workflows on commits it creates (security feature)
# With PAT, Felix commits will trigger workflows so check-dist and other required jobs run
- name: Fix formatting issues with Felix (real run)
uses: ./
with:
commit_message: '🤖 Fix-it Felix: Auto-fix formatting issues'
debug: true
env:
GITHUB_TOKEN: ${{ secrets.FELIX_PAT || secrets.GITHUB_TOKEN }}