diff --git a/.github/workflows/generate-contacts.yml b/.github/workflows/generate-contacts.yml index 31f55bc..e2439af 100644 --- a/.github/workflows/generate-contacts.yml +++ b/.github/workflows/generate-contacts.yml @@ -14,7 +14,10 @@ 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 @@ -25,7 +28,18 @@ jobs: 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 @@ -62,22 +76,38 @@ jobs: fi done - - name: Check for changes - id: check-changes - run: | - git add generated/ - if git diff --cached --quiet; then - echo "No changes to commit" - echo "changed=false" >> $GITHUB_OUTPUT - else - echo "Changes detected" - echo "changed=true" >> $GITHUB_OUTPUT - fi - - - name: Commit and push generated contacts - if: steps.check-changes.outputs.changed == 'true' + - 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 }} + + ## Files Changed + Files in `generated/` directory have been updated. + + ## Review Checklist + - [ ] Verify contact counts are reasonable + - [ ] Check for unexpected changes + - [ ] Confirm filter files are correct + 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: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git commit -m "Update filtered contact lists [skip ci]" - git push + 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."