Update Submodules #860
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
# | |
# Copyright (c) 2011-2022 ETH Zurich. | |
name: Update Submodules | |
on: | |
workflow_dispatch: # allow to manually trigger this workflow | |
schedule: | |
- cron: '0 6 * * *' # run every day at 06:00 UTC | |
jobs: | |
# Update the submodules and create a PR if there are any changes | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Get current commits | |
run: | | |
echo "PREV_GOBRA_REF=$(git -C server/gobra rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Update Gobra submodule | |
run: git checkout master && git pull | |
working-directory: server/gobra | |
- name: Get new commits | |
run: | | |
echo "CUR_GOBRA_REF=$(git -C server/gobra rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Open a pull request | |
id: pr | |
uses: peter-evans/create-pull-request@v7 | |
if: env.PREV_GOBRA_REF != env.CUR_GOBRA_REF | |
with: | |
# Use viper-admin's token to workaround a restriction of GitHub. | |
# See: https://github.com/peter-evans/create-pull-request/issues/48 | |
token: ${{ secrets.VIPER_ADMIN_TOKEN }} | |
commit-message: Updates submodules | |
title: Update Submodules | |
branch: auto-update-submodules | |
delete-branch: true | |
labels: | | |
automated pr | |
body: | | |
* Updates Gobra from `${{ env.PREV_GOBRA_REF }}` to `${{ env.CUR_GOBRA_REF }}`. | |
- name: Enable auto-merge of PR | |
if: env.PREV_GOBRA_REF != env.CUR_GOBRA_REF | |
run: gh pr merge --merge --auto "${{ steps.pr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ secrets.VIPER_ADMIN_TOKEN }} |