Skip to content

Commit

Permalink
CD: Auto send rebuild requests to COPR (#1)
Browse files Browse the repository at this point in the history
* CD: add mock triggering code

* CD: fix webhook URL

* CD: set job timeout

* CD: only run trigger step when spec files are modified

* CD: actually send requests with curl

* CD: use actual webhook URL

* CD: improve curl call

* CD: print build URL
  • Loading branch information
cyqsimon committed Oct 10, 2023
1 parent 736a140 commit 572906c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/rebuild-changed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,28 @@ jobs:
trigger-rebuild-for-modified:
name: Trigger rebuild for modified .spec files
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Install ripgrep
run: sudo apt-get install -y ripgrep

- name: Checkout repository
uses: actions/checkout@v4

# TODO
- name: Get modified .spec files
id: spec-modified
uses: tj-actions/changed-files@v39
with:
files: specs/*.spec

- name: Send rebuild request to COPR
if: ${{ steps.spec-modified.outputs.modified_files_count }} != 0
env:
URL: ${{ secrets.COPR_WEBHOOK_URL }}
run: |
for FILE in ${{ steps.spec-modified.outputs.modified_files }}; do
PKG=$(rg '^Name:\s*([\w\d_\-]+)\s*$' --replace '$1' $FILE)
echo "Package $PKG changed (Spec file: $FILE); sending rebuild request"
BUILD_ID=$(curl -Ssf -X POST "$URL/$PKG")
echo "Build submitted: https://copr.fedorainfracloud.org/coprs/build/$BUILD_ID"
done

0 comments on commit 572906c

Please sign in to comment.