Exportar para Android e iOS #323
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: Exportar para Android e iOS | |
| on: | |
| workflow_run: | |
| workflows: ["Obtener Números Spam"] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| jobs: | |
| process: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Upload numbers as artifact | |
| uses: actions/upload-artifact@v4 | |
| if: github.event_name == 'workflow_dispatch' | |
| with: | |
| name: phone-numbers | |
| path: lista_numeros_spam.txt | |
| - name: Download artifact | |
| uses: dawidd6/action-download-artifact@v11 | |
| with: | |
| name: phone-numbers | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| workflow: scraper.yml | |
| path: artifacts | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Create comma-separated version | |
| run: | | |
| cat artifacts/lista_numeros_spam.txt | tr '\n' ',' | sed 's/,$//' > numeros_spam_dialer.txt | |
| - name: Create spam-blocker version | |
| # raw + pattern | |
| run: | | |
| cat artifacts/lista_numeros_spam.txt > numeros_spam_blocker.txt | |
| sed -i '1i pattern' numeros_spam_blocker.txt | |
| - name: Create VCF file | |
| run: | | |
| # Start VCF file with header | |
| echo "BEGIN:VCARD" > contactos_spam.vcf | |
| echo "VERSION:3.0" >> contactos_spam.vcf | |
| echo "FN:Spam" >> contactos_spam.vcf | |
| # Add all phone numbers to the contact | |
| item_count=1 | |
| while IFS= read -r number; do | |
| echo "item${item_count}.TEL:${number}" >> contactos_spam.vcf | |
| ((item_count++)) | |
| done < artifacts/lista_numeros_spam.txt | |
| echo "END:VCARD" >> contactos_spam.vcf | |
| - name: Upload processed files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: processed-numbers | |
| path: | | |
| contactos_spam.vcf | |
| numeros_spam_dialer.txt | |
| numeros_spam_blocker.txt | |
| - name: Commit and push processed files | |
| run: | | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| git add contactos_spam.vcf numeros_spam_dialer.txt numeros_spam_blocker.txt | |
| git diff-index --quiet HEAD || (git commit -m "Add processed spam numbers [skip ci]" && git push) |