Accept a comma-separated list in the package input
This commit is contained in:
1 parent
f59f2054a6
commit
32481daa30
2 files changed
+26
-10
No files matched your search
@@ -8,10 +8,10 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
package:
|
||||
# One package instead of all of them: a full run builds every package
|
||||
# in turn, and one near the end of the list waits behind every source
|
||||
# build before it gets its turn.
|
||||
description: 'Only update this package directory (empty: all packages)'
|
||||
# A few packages instead of all of them: a full run builds every
|
||||
# package in turn, and one near the end of the list waits behind every
|
||||
# source build before it gets its turn.
|
||||
description: 'Only update these package directories, comma-separated (empty: all packages)'
|
||||
type: string
|
||||
required: false
|
||||
default: ''
|
||||
@@ -41,14 +41,28 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
- id: list
|
||||
env:
|
||||
PACKAGE: ${{ inputs.package }}
|
||||
PACKAGES: ${{ inputs.package }}
|
||||
run: |
|
||||
if [ -n "$PACKAGE" ]; then
|
||||
if [ ! -f "$PACKAGE/PKGBUILD" ]; then
|
||||
echo "::error::there is no package directory named '$PACKAGE'"
|
||||
if [ -n "$PACKAGES" ]; then
|
||||
# split on commas, trim, drop empty entries and duplicates, keep
|
||||
# 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
|
||||
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
|
||||
echo "packages=$(ls -d */PKGBUILD 2>/dev/null | xargs -r -n1 dirname | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
@@ -115,4 +115,6 @@ Then create a directory named after the AUR package containing:
|
||||
|
||||
The workflow discovers package directories automatically. Trigger a run
|
||||
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.
|
||||
Reference in new issue
Block a user