Factory/.gitea/workflows/pr_project.yaml
Nicolas Belouin d6d501ad99 Sync metadata, revamp PR jobs
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
2025-02-20 11:05:47 +01:00

40 lines
1.4 KiB
YAML

name: Synchronize Project Config
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- closed
branches-ignore:
- "devel"
jobs:
sync-prjconf:
runs-on: tumbleweed
steps:
- run: |
zypper in -y python3-jinja2
mkdir -p ~/.config/osc
cat >~/.config/osc/oscrc <<EOF
[general]
apiurl = https://api.opensuse.org
[https://api.opensuse.org]
user=${{ vars.OBS_USERNAME }}
pass=${{ secrets.OBS_PASSWORD }}
EOF
# Waiting on PR to get merged for support in upstream action/checkout action
- uses: 'https://github.com/yangskyboxlabs/action-checkout@sha256'
with:
object-format: 'sha256'
- if: gitea.event.action == "closed"
run: |
PROJECT="$(grep PROJECT .obs/common.py | sed 's/PROJECT = "\(.*\)"/\1/')"
osc rdelete "${PROJECT}:Staging:PR-${{ gitea.event.number }}"
- if: gitea.event.action != "closed"
env:
SCM_URL: ${{ gitea.event.pull_request.head.repo.clone_url }}#${{ gitea.head_ref }}
run: |
PROJECT="$(grep PROJECT .obs/common.py | sed 's/PROJECT = "\(.*\)"/\1/')"
python3 .obs/render_meta.py --pr ${{ gitea.event.number }} --scm-url "${SCM_URL}" | osc meta prj "${PROJECT}:Staging:PR-${{ gitea.event.number }}" -F -