Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#76 Adds support for mute args #77

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ This required input sets which plugin verifier failures to cause a failure in th
the two default checks as of authoring this capability. This may change in the future, but a minor version bump (at a
minimum) will happen should that occur.

### `mute-plugin-problems`

This optional input sets which plugins problems will be ignored. Multiple values can be passed in as a comma-separated string.

See https://github.com/JetBrains/intellij-plugin-verifier?tab=readme-ov-file#check-plugin for more details.

#### Valid options

- `ForbiddenPluginIdPrefix`
- `TemplateWordInPluginId`
- `TemplateWordInPluginName`

## Results
The results of the execution are captured in a file for use in subsequent steps if you so choose.

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ inputs:
# were the two default checks as of authoring this input feature. This may change in the future,
# but a minor version bump (at a minimum) will happen if/when that occurs.
default: 'COMPATIBILITY_PROBLEMS INVALID_PLUGIN'
mute-plugin-problems:
description: 'The comma-separated list of rules to suppress. See https://github.com/JetBrains/intellij-plugin-verifier?tab=readme-ov-file#specific-options for a list of valid values.'
required: false
outputs:
verification-output-log-filename:
description: The filename of the log file generated from the verification output. The output file contains both `stdout` and `stderr` streams.
Expand All @@ -41,4 +44,5 @@ runs:
- ${{ inputs.verifier-version }}
- ${{ inputs.plugin-location }}
- ${{ inputs.ide-versions }}
- ${{ inputs.failure-levels }}
- ${{ inputs.failure-levels }}
- ${{ inputs.mute-plugin-problems }}
22 changes: 18 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ INPUT_IDE_VERSIONS="$3"
# failure-levels: ['COMPATIBILITY_PROBLEMS', 'INVALID_PLUGIN']
FAILURE_LEVELS="$4"

# Found from: https://github.com/JetBrains/intellij-plugin-verifier?tab=readme-ov-file#specific-options
#
# Input string can be a comma separated list
#
# mute-plugin-problems: 'ForbiddenPluginIdPrefix,TemplateWordInPluginId,TemplateWordInPluginName'
INPUT_MUTE_PLUGIN_PROBLEMS="$5"

# the content-type headers returned by the platform download calls
PLATFORM_RESPONSE_ACCEPTED_CONTENT_TYPES="application/octet-stream application/x-zip-compressed"

Expand All @@ -144,6 +151,7 @@ gh_debug "FAILURE_LEVELS =>"
echo "$FAILURE_LEVELS" | while read -r FAILURE_LEVEL; do
gh_debug " => $FAILURE_LEVEL"
done
gh_debug "INPUT_MUTE_PLUGIN_PROBLEMS => $INPUT_MUTE_PLUGIN_PROBLEMS"

# If the user passed in a file instead of a list, pull the IDE+version combos from the file and use that instead.
if [[ -f "$GITHUB_WORKSPACE/$INPUT_IDE_VERSIONS" ]]; then
Expand Down Expand Up @@ -419,6 +427,12 @@ done
# any warning / error messages are not masked by the log group.
cat $post_loop_messages

MUTE_ARGS=""

if [ "${INPUT_MUTE_PLUGIN_PROBLEMS}" ] ; then
MUTE_ARGS="-mute ${INPUT_MUTE_PLUGIN_PROBLEMS}"
fi

##
# Print ENVVARs for debugging.
##
Expand Down Expand Up @@ -451,10 +465,10 @@ echo "::endgroup::" # END "Running verification on $PLUGIN_LOCATION for $IDE_DIR
VERIFICATION_OUTPUT_LOG="verification_result.log"
echo "::group::Running verification on $PLUGIN_LOCATION for $IDE_DIRECTORIES..."

gh_debug "RUNNING COMMAND: java -jar \"$VERIFIER_JAR_LOCATION\" check-plugin $PLUGIN_LOCATION $IDE_DIRECTORIES"
gh_debug "RUNNING COMMAND: java -jar \"$VERIFIER_JAR_LOCATION\" check-plugin $PLUGIN_LOCATION $IDE_DIRECTORIES $MUTE_ARGS"

# We don't wrap $IDE_DIRECTORIES in quotes at the end of this to allow
# the single string of args (ie, `"a b c"`) be broken into multiple
# We don't wrap $IDE_DIRECTORIES or $MUTE_ARGS in quotes at the end of this to
# allow the single string of args (ie, `"a b c"`) be broken into multiple
# arguments instead of being wrapped in quotes when passed to the command.
# ie, we want:
# cat a b c
Expand All @@ -468,7 +482,7 @@ gh_debug "RUNNING COMMAND: java -jar \"$VERIFIER_JAR_LOCATION\" check-plugin $PL
set +o errexit

# shellcheck disable=SC2086
java -jar "$VERIFIER_JAR_LOCATION" check-plugin $PLUGIN_LOCATION $IDE_DIRECTORIES 2>&1 | tee "$VERIFICATION_OUTPUT_LOG"
java -jar "$VERIFIER_JAR_LOCATION" check-plugin $PLUGIN_LOCATION $IDE_DIRECTORIES $MUTE_ARGS 2>&1 | tee "$VERIFICATION_OUTPUT_LOG"
# We use `${PIPESTATUS[0]}` here instead of `$?` as the later returns the status code for the `tee` call, and we want the status code of the `java` invocation of the verifier, which `${PIPESTATUS[0]}` provides.
VERIFICATION_SUCCESSFUL=${PIPESTATUS[0]}

Expand Down