Debian Codegraph @

.github/workflows/cruft.yaml

raw symbols SCIP
1 ---
2 name: Update repository with Cruft
3 permissions:
4 contents: write
5 pull-requests: write
6 on:
7 schedule:
8 - cron: "0 2 * * 1" # Every Monday at 2am
9 jobs:
10 update:
11 runs-on: ubuntu-latest
12 strategy:
13 fail-fast: true
14 matrix:
15 include:
16 - add-paths: .
17 body: Use this to merge the changes to this repository.
18 branch: cruft/update
19 commit-message: "chore: accept new Cruft update"
20 title: New updates detected with Cruft
21 - add-paths: .cruft.json
22 body: Use this to reject the changes in this repository.
23 branch: cruft/reject
24 commit-message: "chore: reject new Cruft update"
25 title: Reject new updates detected with Cruft
26 steps:
27 - uses: actions/checkout@v3
28
29 - uses: actions/setup-python@v4
30 with:
31 python-version: "3.11"
32
33 - name: Install Cruft
34 run: pip3 install cruft
35
36 - name: Check if update is available
37 continue-on-error: false
38 id: check
39 run: |
40 CHANGES=0
41 if [ -f .cruft.json ]; then
42 if ! cruft check; then
43 CHANGES=1
44 fi
45 else
46 echo "No .cruft.json file"
47 fi
48
49 echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
50
51
52 - name: Run update if available
53 if: steps.check.outputs.has_changes == '1'
54 run: |
55 git config --global user.email "[email protected]"
56 git config --global user.name "Allen Porter"
57
58 cruft update --skip-apply-ask --refresh-private-variables
59 git restore --staged .
60
61
62 - name: Create pull request
63 if: steps.check.outputs.has_changes == '1'
64 uses: peter-evans/create-pull-request@v4
65 with:
66 token: ${{ secrets.GITHUB_TOKEN }}
67 add-paths: ${{ matrix.add-paths }}
68 commit-message: ${{ matrix.commit-message }}
69 branch: ${{ matrix.branch }}
70 delete-branch: true
71 branch-suffix: timestamp
72 title: ${{ matrix.title }}
73 body: |
74 This is an autogenerated PR. ${{ matrix.body }}
75
76 [Cruft](https://cruft.github.io/cruft/) has detected updates from the Cookiecutter repository.