Debian Codegraph @

.github/workflows/update_copyright.yml

raw
1 name: Update copyright year
2
3 on:
4 schedule:
5 - cron: '0 4 1 1 *' # Every Jan 1st @ 04:00 UTC
6
7 jobs:
8 update-copyright:
9 if: github.repository_owner == 'cylc'
10 runs-on: ubuntu-latest
11 timeout-minutes: 10
12 steps:
13
14 - name: Checkout repo
15 uses: actions/checkout@v5
16
17 - name: Configure git
18 uses: cylc/release-actions/configure-git@v1
19
20 - name: Checkout PR branch
21 uses: cylc/release-actions/checkout-copyright-branch@v1
22
23 - name: Update copyright year
24 env:
25 README_FILE: 'README.md'
26 SCRIPTS_INIT_FILE: 'cylc/flow/scripts/__init__.py'
27 run: |
28 pattern="(<span actions:bind='current-year'>).*(<\/span>)"
29 sed -i -E "s/${pattern}/\1${YEAR}\2/" "$README_FILE"
30
31 pattern="(_copyright_year ?= ?)[^ #]*(.*)"
32 sed -i -E "s/${pattern}/\1${YEAR}\2/" "$SCRIPTS_INIT_FILE"
33
34 - name: Commit & push
35 run : |
36 git commit -a -m "Update copyright year" -m "Workflow: ${{ github.workflow }}, run: ${{ github.run_number }}"
37 git push
38
39 - name: Create pull request
40 uses: cylc/release-actions/create-pr@v1
41 env:
42 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 with:
44 head: ${{ env.BRANCH_NAME }}
45 title: 'Auto PR: update copyright year'
46 body: 'Happy new year!'