Sync custom.css from Green Finance AI repo #10
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: Sync custom.css to Green Finance AI | |
| on: | |
| push: | |
| paths: | |
| - "css/custom.css" | |
| branches: | |
| - main | |
| jobs: | |
| sync-file: | |
| if: github.actor != 'github-actions[bot]' # Prevents infinite loops | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source repo | |
| uses: actions/checkout@v3 | |
| - name: Copy custom.css to the target repo | |
| env: | |
| PAT_TOKEN: ${{ secrets.SYNC_CSS_GFAI }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| # Clone the target repository (Green-Finance-AI) | |
| git clone https://$PAT_TOKEN@github.com/Green-Finance-AI/Green-Finance-AI.git target-repo | |
| # Copy the file | |
| cp css/custom.css target-repo/dark-creative/css/custom.css | |
| cd target-repo | |
| git add dark-creative/css/custom.css | |
| # Commit only if there are changes, otherwise exit successfully | |
| git diff --cached --exit-code || (git commit -m "Sync custom.css from Training Platform repo" && git push) |