Localization Pull Action #1
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: Localization Pull Action | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| sync_localizations: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Pull Google Sheets to JSON | |
| uses: ./ # Use the local action | |
| with: | |
| action: pull | |
| google_api_key_json: '${{ secrets.GOOGLE_API_KEY_JSON }}' | |
| spreadsheet_id: ${{ vars.SPREADSHEET_ID }} | |
| localization_root: ./Acme.BookStore/src/Acme.BookStore.Domain.Shared/Localization | |
| - name: Add localization files | |
| run: git add Acme.BookStore/src/Acme.BookStore.Domain.Shared/Localization/**/*.json | |
| - name: Commit changes | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| if git diff-index --quiet HEAD; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Updated localizations from Google Sheets" | |
| git push | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |