Skip to content

Commit

Permalink
fix: support comma separated files input (#3)
Browse files Browse the repository at this point in the history
* Add test cases for multiple spec files

* Cleanup dnf cache after installing

* Accept comma-separated list of spec files

* Update comment (remove Copilot prompt)

* chore(ci): Add test for comma separated rpmfiles, and set rpmlint as permissive

* chore(ci): Perform tests on pull request

* chore(ci): Disable permissive

---------

Co-authored-by: RJ Trujillo <eyecantcu@pm.me>
  • Loading branch information
p5 and EyeCantCU committed Dec 20, 2023
1 parent b273cb6 commit ab9ea0e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Test Action
on:
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- '**.txt'
push:
branches:
- main
Expand All @@ -26,8 +32,14 @@ jobs:
- name: Fetch spec
run: |
wget https://raw.githubusercontent.com/ublue-os/packages/main/staging/devpod/devpod.spec
wget https://raw.githubusercontent.com/ublue-os/packages/main/staging/prompt/prompt.spec
- name: Test rpmlint
- name: Test rpmlint (single file)
uses: ./
with:
rpmfiles: ./devpod.spec

- name: Test rpmlint (multiple files)
uses: ./
with:
rpmfiles: './devpod.spec, ./prompt.spec'
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ author: 'EyeCantCU'
description: 'Checks for errors in RPMs via rpmlint'
inputs:
rpmfiles:
description: 'Files to be validated by rpmlint'
description: 'Comma-separated list of files to be validated by rpmlint'
required: false
help:
description: 'Show help message and exit'
Expand Down
2 changes: 1 addition & 1 deletion container/Containerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM quay.io/fedora/fedora-minimal:39 AS rpmlint-action

RUN dnf5 install -y rpmlint
RUN dnf5 install -y rpmlint && dnf5 clean all
6 changes: 4 additions & 2 deletions rpmlint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ if [[ -n "${PERMISSIVE}" ]]; then ARGUMENTS+=" -p "; fi
# Format arguments
ARGUMENTS=$(echo "$ARGUMENTS" | xargs)

# Perform rpmlint
# Perform rpmlint on comma-separated list of files
if [[ -n "${RPMFILES}" ]]; then
rpmlint $ARGUMENTS ${RPMFILES[@]}
for FILE in $(echo "${RPMFILES}" | tr "," "\n"); do
rpmlint $ARGUMENTS $FILE
done
else
rpmlint $ARGUMENTS
fi

0 comments on commit ab9ea0e

Please sign in to comment.