blob: aba1d6cfb3136370c0368ecd47a3734f8a23c4db [file] [log] [blame]
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Sets submodule state to the one specified in SUBMODULE_VERSIONS
name: Synchronize Submodules
on:
push:
branches:
- google
jobs:
synchronize:
runs-on: ubuntu-18.04
steps:
- name: Checking out repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_WRITE_ACCESS_TOKEN }}
- name: Initializing submodules
run: ./scripts/git/submodule_versions.py init
- name: Checking submodule state
run: |
echo "::set-env name=has_diff::false"
git diff --cached --exit-code || echo "::set-env name=has_diff::true"
- name: Committing updates
if: env.has_diff == 'true'
run: |
git config --local user.email "iree-github-actions-bot@google.com"
git config --local user.name "Submodule Synchronize Action"
git commit -am "Synchronize submodules"
- name: Pushing changes
if: env.has_diff == 'true'
uses: ad-m/github-push-action@v0.5.0
with:
github_token: ${{ secrets.GITHUB_WRITE_ACCESS_TOKEN }}
branch: ${{ github.ref }}