Update distant public repo from working repo #868
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: Update distant public repo from working repo | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '30 5,17 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| path: distant-public | |
| - uses: actions/checkout@v2 | |
| with: | |
| repository: AustralianAntarcticDivision/distant-working | |
| path: distant-working | |
| token: ${{secrets.PUSH_TOKEN}} | |
| - name: Update public stuff | |
| run: | | |
| cp distant-working/data/metadata.csv distant-public/ | |
| cp distant-working/README-public.md distant-public/README.md | |
| cd distant-public | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| if [ -z "$(git status --porcelain)" ]; | |
| then | |
| exit 0; | |
| fi | |
| git commit -m "Auto update" | |
| git push https://$USERNAME:$REPO_KEY@github.com/SCAR/distant.git | |
| env: | |
| REPO_KEY: ${{secrets.PUSH_TOKEN}} | |
| USERNAME: github-actions[bot] |