|
22 | 22 | runs-on: ubuntu-latest |
23 | 23 |
|
24 | 24 | steps: |
25 | | - # ─────────────────────────── Setup ─────────────────────────── |
26 | 25 | - name: Checkout project repo |
27 | 26 | uses: actions/checkout@v4 |
28 | 27 | with: |
|
38 | 37 | - name: Install dependencies |
39 | 38 | run: pip install cookiecutter jq |
40 | 39 |
|
41 | | - # ───────────── Read old SHA & compare with template HEAD ───────────── |
42 | 40 | - name: Read old template SHA |
43 | 41 | id: old_sha |
44 | 42 | run: | |
|
54 | 52 | run: | |
55 | 53 | echo "sha=$(git ls-remote '${{ inputs.template_repo }}' HEAD | cut -f1)" >> "$GITHUB_OUTPUT" |
56 | 54 |
|
57 | | - - name: Decide whether to continue |
| 55 | + - name: Determine if Template was updated |
58 | 56 | run: | |
59 | 57 | if [ "${{ steps.old_sha.outputs.sha }}" = "${{ steps.new_sha.outputs.sha }}" ]; then |
60 | 58 | echo "SHA_CHANGED=false" >> "$GITHUB_ENV" |
|
66 | 64 | if: env.SHA_CHANGED == 'false' |
67 | 65 | run: echo "✂️ SHA unchanged; nothing to update." |
68 | 66 |
|
69 | | - # ───────────────── Clone template repo at both SHAs ───────────────── |
70 | 67 | - name: Clone template at OLD SHA |
71 | 68 | if: env.SHA_CHANGED == 'true' |
72 | 69 | run: | |
|
77 | 74 | if: env.SHA_CHANGED == 'true' |
78 | 75 | run: git clone '${{ inputs.template_repo }}' template-source |
79 | 76 |
|
80 | | - # ────────────────────── Render OLD template ────────────────────── |
81 | 77 | - name: Render OLD template (base-template → template-base) |
82 | 78 | if: env.SHA_CHANGED == 'true' |
83 | 79 | run: | |
|
89 | 85 | --overwrite-if-exists \ |
90 | 86 | --output-dir template-base |
91 | 87 |
|
92 | | - # ────────────────────── Render NEW template ────────────────────── |
93 | 88 | - name: Render NEW template (template-source → template-new) |
94 | 89 | if: env.SHA_CHANGED == 'true' |
95 | 90 | run: | |
|
101 | 96 | --overwrite-if-exists \ |
102 | 97 | --output-dir template-new |
103 | 98 |
|
104 | | - # ───────────── diff, merge, bump SHA, push branch, open PR ───────────── |
105 | 99 | - name: Apply patch & raise PR |
106 | 100 | if: env.SHA_CHANGED == 'true' |
107 | 101 | shell: bash |
|
0 commit comments