Repository navigation
53 lines (46 loc) · 1.56 KB
/
Copy pathupdate-python.yml
File metadata and controls
53 lines (46 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Update python Submodule
on:
workflow_dispatch:
repository_dispatch:
types: [python-release]
jobs:
update-submodule:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pull latest python
id: update
run: |
git submodule update --init --remote -- python
cd python
new_sha=$(git rev-parse HEAD)
echo "new_sha=$new_sha" >> $GITHUB_OUTPUT
echo "Pulled python @ $new_sha"
- name: Check for changes
id: check
run: |
if git diff --quiet -- python; then
echo "No submodule pointer change — already at latest"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Submodule pointer changed"
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push
if: steps.check.outputs.changed == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add python
git commit -m "Update python submodule to ${{ steps.update.outputs.new_sha }}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Report no changes
if: steps.check.outputs.changed != 'true'
run: echo "python is already at the latest commit — nothing to commit."