|
| 1 | +name: Copier Update |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: 0 7 1/7 * * # Every 7 days at 7:00 UTC |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + Copier: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + token: ${{ secrets.COPIER_PAT }} |
| 15 | + - uses: julia-actions/setup-julia@v2 |
| 16 | + with: |
| 17 | + version: "1" |
| 18 | + - name: Use Julia cache |
| 19 | + uses: julia-actions/cache@v2 |
| 20 | + - name: Install JuliaFormatter.jl |
| 21 | + run: julia -e 'using Pkg; pkg"add JuliaFormatter"' |
| 22 | + - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807 |
| 23 | + run: touch requirements.txt |
| 24 | + - name: Setup Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + cache: 'pip' |
| 28 | + python-version: "3.11" |
| 29 | + - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807 |
| 30 | + run: rm requirements.txt |
| 31 | + - name: Check for update in the template |
| 32 | + run: | |
| 33 | + pip install copier |
| 34 | + copier update -A -o rej |
| 35 | + echo -e "Automated changed by Copier.yml workflow\n" > /tmp/body.md |
| 36 | + echo -e 'Rejected changes (if any):\n```diff\n' >> /tmp/body.md |
| 37 | + find . -name "*.rej" | xargs cat >> /tmp/body.md |
| 38 | + find . -name "*.rej" | xargs rm -f |
| 39 | + echo -e '```' >> /tmp/body.md |
| 40 | + git diff |
| 41 | + - name: Run pre-commit to run the formatters |
| 42 | + run: | |
| 43 | + pip install pre-commit |
| 44 | + pre-commit run -a || true # Ignore pre-commit errors |
| 45 | + - name: Create Pull Request |
| 46 | + id: cpr |
| 47 | + uses: peter-evans/create-pull-request@v6 |
| 48 | + with: |
| 49 | + token: ${{ secrets.COPIER_PAT }} |
| 50 | + commit-message: ":robot: BestieTemplate.jl update" |
| 51 | + title: "[AUTO] BestieTemplate.jl update" |
| 52 | + body-path: /tmp/body.md |
| 53 | + branch: auto-copier-template-update |
| 54 | + delete-branch: true |
| 55 | + labels: configuration, automated pr, no changelog |
| 56 | + - name: Check outputs |
| 57 | + run: | |
| 58 | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
| 59 | + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
0 commit comments