Run Python script on merge to master #543
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: Run Python script on merge to master | |
| on: | |
| schedule: | |
| - cron: '0 0 */1 * *' # update at 00:00 every day | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| run-script: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run update_casks | |
| run: | | |
| python update_casks.py | |
| - name: Run generate_casks | |
| env: | |
| AC_TOKEN: ${{ secrets.AC_TOKEN }} | |
| run: | | |
| python generate_casks.py | |
| - name: Commit and push if it changed | |
| run: | | |
| git config --global user.name 'GitHub Action' | |
| git config --global user.email 'action@github.com' | |
| git add -A | |
| git diff --quiet && git diff --staged --quiet || git commit -m 'Automated update' | |
| git push | |
| # push permissions | |
| # https://github.com/romankurnovskii/homebrew-awesome-brew/settings/actions |