blob: dd85178f6310075eb46dd9be1feb05ab7452fd57 [file] [log] [blame]
# Copyright 2020 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.
# Creates a PR to merge the `google` branch into the `main` branch.
name: google -> main
on:
schedule:
# Every 6 hours at 45 minutes past the hour (to be a bit behind the TF submodule update)
# 00:45, 06:45, 12:45, 18:45 UTC (04:45, 10:45, 16:45, 22:45 PST)
- cron: '45 */6 * * *'
jobs:
google_to_main:
# Don't run this in everyone's forks.
if: github.repository == 'google/iree'
runs-on: ubuntu-18.04
steps:
- name: Checking out repository
uses: actions/checkout@v2
with:
ref: "google"
# We have to explicitly fetch the main branch as well
- name: Fetching Base Branch
run: git fetch --no-tags --prune --depth=1 origin main
- name: Checking for a diff
run: |
echo "::set-env name=has_diff::false"
git diff main --exit-code || echo "::set-env name=has_diff::true"
- name: Calculating PR body
if: env.has_diff == 'true'
run: |
echo "::set-env name=pr_body::$(git log main.. --decorate=no --pretty='format:* %h %<(80,trunc)%s')"
- name: Initializing submodules
if: env.has_diff == 'true'
run: ./scripts/git/submodule_versions.py init
- name: Creating Pull Request
if: env.has_diff == 'true'
uses: peter-evans/create-pull-request@v2
with:
# Personal token is required to trigger additional automation (e.g. presubmits).
token: ${{ secrets.GITHUB_WRITE_ACCESS_TOKEN }}
commit-message: "Merge google -> main"
title: "Merge google -> main"
body: "${{ env.pr_body }}"
committer: "Integrate Action <iree-github-actions-bot@google.com>"
# TODO(gcmn): Figure out a way to assign this to someone dynamically.
reviewers: gmngeoffrey
branch: "google-to-main"
base: "main"