Export Azure Table and Commit #2996
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: Export Azure Table and Commit | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| export-and-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.100' | |
| - name: Run Exporter | |
| id: exporter | |
| run: | | |
| cd src/aka.exporter | |
| output=$(dotnet run $GITHUB_WORKSPACE/exports/aka-export.csv) | |
| echo "$output" | |
| summary=$(echo "$output" | grep "EXPORT_SUMMARY=" | cut -d'=' -f2) | |
| echo "summary=$summary" >> $GITHUB_OUTPUT | |
| env: | |
| AKA_TABLE_CONNECTION_STRING: ${{ secrets.AKA_TABLE_CONNECTION_STRING }} | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts | |
| path: ./exports | |
| - name: Push to generated-report branch | |
| run: | | |
| mkdir temp-publish | |
| cd temp-publish | |
| git init | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
| git fetch origin generated-report || true | |
| if git rev-parse --verify origin/generated-report >/dev/null 2>&1; then | |
| git checkout -B generated-report origin/generated-report | |
| else | |
| git checkout -b generated-report | |
| fi | |
| cp "$GITHUB_WORKSPACE/exports/aka-export.md" ./README.md | |
| git add README.md | |
| git diff --cached --quiet && echo "No changes to push." && exit 0 | |
| git commit -m "🔄 Auto-report of links (${{ steps.exporter.outputs.summary }})" | |
| git push --force-with-lease origin generated-report |