Generate Filtered Contacts #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate Filtered Contacts | |
| on: | |
| # Manual trigger | |
| workflow_dispatch: | |
| # Trigger when filter files change on main branch | |
| push: | |
| branches: [ main, master ] | |
| paths: | |
| - 'filters/**' | |
| jobs: | |
| generate: | |
| name: Generate Filtered Contact Lists | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to push commits to new branch | |
| pull-requests: write # Required to create PRs | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.26.1' | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| bun install | |
| bun run build | |
| - name: Cache RadioID.net contacts | |
| uses: actions/cache@v4 | |
| id: cache-radioid | |
| with: | |
| path: user.csv | |
| key: radioid-contacts-${{ github.run_id }} | |
| restore-keys: | | |
| radioid-contacts- | |
| - name: Download RadioID.net contacts | |
| if: steps.cache-radioid.outputs.cache-hit != 'true' | |
| run: | | |
| echo "Downloading RadioID.net contacts..." | |
| curl -L -o user.csv "https://radioid.net/static/user.csv" | |
| echo "Downloaded $(wc -l < user.csv) lines" | |
| - name: Build codeplugs binary | |
| run: go build -o codeplugs main.go | |
| - name: Create generated directory | |
| run: mkdir -p generated | |
| - name: Generate filtered contacts | |
| run: | | |
| # Process each filter file in filters/ directory | |
| # Generate all three radio formats | |
| for filter_file in filters/*.csv; do | |
| if [ -f "$filter_file" ]; then | |
| filename=$(basename "$filter_file" .csv) | |
| echo "" | |
| echo "==========================================" | |
| echo "Processing filter: $filter_file" | |
| echo "==========================================" | |
| # Generate RadioID format (default) | |
| echo "-> Generating RadioID format..." | |
| ./codeplugs --generate-contacts \ | |
| --filter-file "$filter_file" \ | |
| --source-file user.csv \ | |
| --output-file "generated/${filename}-radioid.csv" \ | |
| --contact-format radioid | |
| # Generate DM32UV format | |
| echo "-> Generating DM32UV format..." | |
| ./codeplugs --generate-contacts \ | |
| --filter-file "$filter_file" \ | |
| --source-file user.csv \ | |
| --output-file "generated/${filename}-dm32uv.csv" \ | |
| --contact-format dm32uv | |
| # Generate AnyTone 890 format | |
| echo "-> Generating AnyTone 890 format..." | |
| ./codeplugs --generate-contacts \ | |
| --filter-file "$filter_file" \ | |
| --source-file user.csv \ | |
| --output-file "generated/${filename}-at890.csv" \ | |
| --contact-format at890 | |
| fi | |
| done | |
| echo "" | |
| echo "==========================================" | |
| echo "Generated files:" | |
| ls -lh generated/*.csv | |
| echo "==========================================" | |
| - name: Create Pull Request | |
| id: create-pr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "Update filtered contact lists" | |
| title: "Auto: Update filtered contact lists" | |
| body: | | |
| This PR was automatically generated by the contact list workflow. | |
| ## Changes | |
| - Updated contact lists based on filter files in `filters/` | |
| - Source: RadioID.net user.csv | |
| - Triggered by: ${{ github.event_name }} | |
| - Generated formats for each filter: | |
| - `*-radioid.csv` - Standard RadioID.net format | |
| - `*-dm32uv.csv` - Baofeng DM32UV format | |
| - `*-at890.csv` - AnyTone 890 format | |
| ## Files Changed | |
| Files in `generated/` directory have been updated. | |
| ## Review Checklist | |
| - [ ] Verify contact counts are reasonable for each format | |
| - [ ] Check for unexpected changes | |
| - [ ] Confirm filter files are correct | |
| - [ ] All three formats generated (radioid, dm32uv, at890) | |
| branch: auto/update-contacts-${{ github.run_id }} | |
| delete-branch: true | |
| add-paths: | | |
| generated/*.csv | |
| - name: Summary | |
| if: steps.create-pr.outputs.pull-request-number != '' | |
| run: | | |
| echo "## Pull Request Created" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **PR #${{ steps.create-pr.outputs.pull-request-number }}**: ${{ steps.create-pr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Please review the generated contact lists before merging." |