Accept a comma-separated list in the package input

This commit is contained in:
Felitendo committed 2026-09-17 15:59:40 +02:00
1 parent f59f2054a6
commit 32481daa30
2 files changed
+26 -10

No files matched your search

+23 -9
View File
@@ -8,10 +8,10 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
package: package:
# One package instead of all of them: a full run builds every package # A few packages instead of all of them: a full run builds every
# in turn, and one near the end of the list waits behind every source # package in turn, and one near the end of the list waits behind every
# build before it gets its turn. # source build before it gets its turn.
description: 'Only update this package directory (empty: all packages)' description: 'Only update these package directories, comma-separated (empty: all packages)'
type: string type: string
required: false required: false
default: '' default: ''
@@ -41,14 +41,28 @@ jobs:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
- id: list - id: list
env: env:
PACKAGE: ${{ inputs.package }} PACKAGES: ${{ inputs.package }}
run: | run: |
if [ -n "$PACKAGE" ]; then if [ -n "$PACKAGES" ]; then
if [ ! -f "$PACKAGE/PKGBUILD" ]; then # split on commas, trim, drop empty entries and duplicates, keep
echo "::error::there is no package directory named '$PACKAGE'" # the given order (it is the build order)
packages=$(jq -cn --arg s "$PACKAGES" '
$s | split(",") | map(gsub("^\\s+|\\s+$"; "") | select(. != ""))
| reduce .[] as $p ([]; if any(.[]; . == $p) then . else . + [$p] end)')
if [ "$packages" = "[]" ]; then
echo "::error::no package name in '$PACKAGES'"
exit 1 exit 1
fi fi
echo "packages=$(jq -cn --arg p "$PACKAGE" '[$p]')" >> "$GITHUB_OUTPUT" # report every unknown name at once, not just the first
missing=0
while IFS= read -r p; do
if [ ! -f "$p/PKGBUILD" ]; then
echo "::error::there is no package directory named '$p'"
missing=1
fi
done < <(jq -r '.[]' <<< "$packages")
[ "$missing" = 0 ] || exit 1
echo "packages=$packages" >> "$GITHUB_OUTPUT"
else else
echo "packages=$(ls -d */PKGBUILD 2>/dev/null | xargs -r -n1 dirname | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT" echo "packages=$(ls -d */PKGBUILD 2>/dev/null | xargs -r -n1 dirname | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT"
fi fi
+3 -1
View File
@@ -115,4 +115,6 @@ Then create a directory named after the AUR package containing:
The workflow discovers package directories automatically. Trigger a run The workflow discovers package directories automatically. Trigger a run
manually via *Actions → Update AUR packages → Run workflow* to publish it manually via *Actions → Update AUR packages → Run workflow* to publish it
immediately. immediately. To update only some packages, enter their directory names,
separated by commas (e.g. `concat, plezy-bin`); leave the field empty to update
all of them.