-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (39 loc) · 1.26 KB
/
upgrade-submodules.yml
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
name: upgrade-submodules
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * 5' # 9:00AM on Friday
jobs:
open_pull_request:
if: github.repository == 'saleor/saleor-platform'
runs-on: ubuntu-20.04
steps:
- name: Checkout recursively
uses: actions/checkout@v2
with:
submodules: recursive
- name: Configure git
run: |
git config user.name 'DevRel Bot'
git config user.email '[email protected]'
- name: Update submodules
run: |
git submodule foreach git checkout main
git submodule foreach git pull
- name: Check if something changed
run: |
echo "NO_OF_CHANGES=$(git status --short | wc -l)" >> $GITHUB_ENV
echo "BRANCH_NAME=submodules-upgrade-$(date '+%Y%m%d%H%M')" >> $GITHUB_ENV
- name: Create new branch, commit upgrades and push it
if: env.NO_OF_CHANGES != '0'
run: |
git checkout -b $BRANCH_NAME
git add .
git commit -m"Periodic submodules upgrade"
git push --set-upstream origin $BRANCH_NAME
- name: Open pull request
if: env.NO_OF_CHANGES != '0'
run: |
gh pr create --fill
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}