Skip to content

Merge pull request #2061 from SUSE/headache_reduction #1525

Merge pull request #2061 from SUSE/headache_reduction

Merge pull request #2061 from SUSE/headache_reduction #1525

---
name: Update the deployment branches containing the build recipes
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
jobs:
create-pull-requests:
name: create pull requests if the build recipes changed
runs-on: ubuntu-latest
container:
image: ghcr.io/dcermak/bci-ci:latest
options: "--privileged"
strategy:
fail-fast: false
matrix:
os_version:
- 7
- 6
- 5
- "16.0"
- Tumbleweed
steps:
- uses: actions/checkout@v4
with:
# we need all branches for the build checks
fetch-depth: 0
# ensure that we have write permissions for pushes
token: ${{ secrets.CHECKOUT_TOKEN }}
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ hashFiles('poetry.lock') }}
- name: fix the file permissions of the repository
run: chown -R $(id -un):$(id -gn) .
- name: install python dependencies
run: poetry install
- name: setup the continuous rebuild project
run: poetry run scratch-build-bot --os-version ${{ matrix.os_version }} create_cr_project
env:
OSC_PASSWORD: ${{ secrets.OSC_PASSWORD }}
OSC_USER: "defolos"
- name: configure git user
run: |
git config user.name "SUSE Update Bot"
git config user.email "[email protected]"
- name: commit the changes to a test branch
run: |
set -euo pipefail
poetry run scratch-build-bot \
--os-version ${{ matrix.os_version }} \
-vvvv \
--branch-name "for-deploy-${{ matrix.os_version }}" \
commit_state \
--commit-message "🤖: Update build recipes from templates" \
| tee commit_state_out
if [[ "$(wc -l commit_state_out | awk '{print $1}')" = "1" ]]; then
echo "DEPLOYMENT_COMMIT_HASH=$(cat commit_state_out)" >> $GITHUB_ENV
else
echo "no_change=true" >> $GITHUB_ENV
fi
cat test-build.env >> $GITHUB_ENV
env:
OSC_USER: "defolos"
OSC_PASSWORD: ${{ secrets.OSC_PASSWORD }}
- name: create a pull request
uses: vsoch/pull-request-action@master
id: create-pr
env:
GITHUB_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
PULL_REQUEST_FROM_BRANCH: ${{ env.BRANCH_NAME }}
PULL_REQUEST_BRANCH: ${{ env.DEPLOYMENT_BRANCH_NAME }}
PULL_REQUEST_TITLE: "🤖: Update build recipes for ${{ env.OS_VERSION_PRETTY }}"
PULL_REQUEST_UPDATE: 1
PULL_REQUEST_REVIEWERS: "fcrozat PVlasin dirkmueller"
if: env.no_change != 'true'