Sync to openshift/os #44
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
name: Sync to openshift/os | |
on: | |
# We could do push: branches: [testing-devel] but that would restart | |
# downstream CI a lot | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
inputs: | |
branch-name: | |
# Allow overriding branch for syncs that need manual fixups | |
description: PR branch name | |
required: true | |
default: fcc-sync | |
branch: | |
# Allow specifying the source branch for backports | |
description: Source branch to use for PR | |
required: true | |
default: testing-devel | |
target-branch: | |
# Allow specifying the target branch for backports | |
description: Target branch to open PR against | |
required: true | |
default: master | |
permissions: | |
# none at all | |
contents: none | |
jobs: | |
update-submodule: | |
name: Update fedora-coreos-config submodule | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
repository: openshift/os | |
# We need an unbroken commit chain when pushing to the fork. Don't | |
# make assumptions about which commits are already available there. | |
fetch-depth: 0 | |
- name: Update submodule | |
env: | |
BRANCH_NAME: ${{ github.event.inputs.branch-name }} | |
SOURCE_BRANCH: ${{ github.event.inputs.branch }} | |
TARGET_BRANCH: ${{ github.event.inputs.target-branch }} | |
run: | | |
set -euxo pipefail | |
# Default branches names for on.schedule case | |
echo "BRANCH_NAME=${BRANCH_NAME:-fcc-sync}" >> $GITHUB_ENV | |
echo "SOURCE_BRANCH=${SOURCE_BRANCH:-testing-devel}" >> $GITHUB_ENV | |
echo "TARGET_BRANCH=${TARGET_BRANCH:-master}" >> $GITHUB_ENV | |
git submodule init | |
git submodule update | |
cd fedora-coreos-config | |
# Omit CoreOS Bot commits from the log message, since they generally | |
# only affect FCOS | |
git shortlog "HEAD..testing-devel" --perl-regexp \ | |
--author='^((?!CoreOS Bot <[email protected]>).*)$' \ | |
> $RUNNER_TEMP/shortlog | |
if [ ! -s $RUNNER_TEMP/shortlog ]; then | |
# Any changes have been made by CoreOS Bot. Ignore. | |
echo "No non-trivial changes; exiting" | |
exit 0 | |
fi | |
git checkout $SOURCE_BRANCH | |
marker=OPENSHIFT-OS-END-OF-LOG-MARKER-$RANDOM$RANDOM$RANDOM | |
cat >> $GITHUB_ENV <<EOF | |
SHORTLOG<<$marker | |
$(cat $RUNNER_TEMP/shortlog) | |
$marker | |
EOF | |
- name: Open pull request | |
uses: peter-evans/[email protected] | |
with: | |
token: ${{ secrets.COREOSBOT_RELENG_TOKEN }} | |
push-to-fork: coreosbot-releng/os | |
branch: ${{ env.BRANCH_NAME }} | |
base: ${{ env.TARGET_BRANCH }} | |
commit-message: | | |
Bump fedora-coreos-config | |
${{ env.SHORTLOG }} | |
title: "NO-JIRA: Bump fedora-coreos-config" | |
body: | | |
Created by [GitHub workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/openshift-os.yml) ([source](${{ github.server_url }}/${{ github.repository }}/blob/testing-devel/.github/workflows/openshift-os.yml)). | |
``` | |
${{ env.SHORTLOG }} | |
``` | |
committer: "CoreOS Bot <[email protected]>" | |
author: "CoreOS Bot <[email protected]>" |