Skip to content

liferay/liferay-portal / .claude/skills/pr-check

pr-check

Verified

Check that a PR is ready to be sent for review.

FileKindSize
SKILL.mdskill md36.5 KB
find_modules.shexecutablescript1.4 KB
references/testing.mdmarkdown5.4 KB
select_paths.shexecutablescript2.2 KB
select_validations.shexecutablescript1.1 KB
validations/branch/bean-param-util-getter.mdmarkdown6.6 KB
validations/branch/bnd-content.mdmarkdown15.2 KB
validations/branch/bnd-dsannotations-options.mdmarkdown9.1 KB
validations/branch/cache-field-usage.mdmarkdown13.9 KB
validations/branch/concurrent-mapper-hash-map-usage.mdmarkdown7.5 KB
validations/branch/html-escaping.mdmarkdown2.6 KB
validations/branch/pr-reviewer.mdmarkdown6.6 KB
validations/branch/redundant-assert-message.mdmarkdown13.5 KB
validations/branch/required-configuration-policy.mdmarkdown7.9 KB
validations/branch/service-holder-usage.mdmarkdown8.3 KB
validations/branch/service-registration.mdmarkdown3.7 KB
validations/branch/source-format.mdmarkdown4.1 KB
validations/branch/startup-sync-usage.mdmarkdown10.6 KB
validations/branch/transaction-usage.mdmarkdown4.0 KB
validations/branch/unused-project-dependencies.mdmarkdown18.5 KB
validations/portal/baseline.mdmarkdown14.0 KB
validations/portal/cross-module-compile.mdmarkdown7.9 KB
validations/portal/full-portal-build.mdmarkdown1.4 KB
validations/portal/go-generate.mdmarkdown2.8 KB
validations/portal/go-source-format.mdmarkdown1.9 KB
validations/portal/helm-unit-test-order.mdmarkdown1.4 KB
validations/portal/instance-wrapper-build.mdmarkdown656 B
validations/portal/java-unit-test.mdmarkdown6.7 KB
validations/portal/javascript-unit-test.mdmarkdown7.7 KB
validations/portal/module-registration.mdmarkdown7.8 KB
validations/portal/per-module-compile.mdmarkdown10.4 KB
validations/portal/portlet-title.mdmarkdown1.1 KB
validations/portal/poshi-syntax.mdmarkdown336 B
validations/portal/pql-validation.mdmarkdown516 B
validations/portal/rest-builder.mdmarkdown938 B
validations/portal/service-builder.mdmarkdown1.6 KB
validations/portal/structural-smoke.mdmarkdown3.9 KB
validations/portal/theme-build.mdmarkdown2.0 KB
validations/workspaces/generated-file.mdmarkdown2.5 KB
validations/workspaces/source-format.mdmarkdown2.0 KB
validations/workspaces/workspace-compile.mdmarkdown1.8 KB
validations/workspaces/workspace-java-unit-test.mdmarkdown1.7 KB
validations/workspaces/workspace-javascript-unit-test.mdmarkdown1.9 KB

select_paths.sh

View on GitHub
#!/usr/bin/env bash

function main {
	set -o pipefail

	if ! git rev-parse --quiet --verify "${1}^{commit}" > /dev/null
	then
		_exit_with_error "Unable to resolve the merge base \"${1}\""
	fi

	local regex

	regex=$( \
		sed -e "/^## Match$/{n;n;p;}" -n "${2}" | \
			sed -e "s/^.//" -e "s/.$//")

	if [[ -z ${regex} ]]
	then
		_exit_with_error "Unable to find a \"## Match\" section in ${2}"
	fi

	local exclude=$(echo "${regex}" | sed -e "s/^.* &! //p" -n)

	if [[ -z ${exclude} ]]
	then
		exclude="^$"
	fi

	local folder_name

	folder_name=$(basename "$(dirname "${2}")")

	if [[ $(type -t "_get_${folder_name}_paths") != function ]]
	then
		_exit_with_error "Unable to select paths for a validation in the ${folder_name} folder"
	fi

	git diff --name-only --no-renames "${1}...HEAD" | \
		"_get_${folder_name}_paths" "${2}" "${3}" | \
		grep --extended-regexp -- "$(echo "${regex}" | sed -e "s/ &! .*$//")" | \
		grep --extended-regexp --invert-match -- "${exclude}" | \
		sed -e "s#^workspaces/${3}/##"
}

function _exit_with_error {
	echo "${*}" >&2

	exit 1
}

function _get_branch_paths {
	cat
}

function _get_portal_paths {
	grep --extended-regexp --invert-match "^workspaces/[^/]+-workspace/"
}

function _get_workspaces_paths {
	if [[ -z ${2} ]]
	then
		_exit_with_error "Unable to select paths for ${1} without a workspace name"
	fi

	local owned_paths_regex="^workspaces/${2}/"
	local refresh_script

	refresh_script="$(git rev-parse --show-toplevel)/workspaces/refresh_other_workspaces.sh"

	if [[ ${2} != liferay-sample-workspace ]] && [[ -f ${refresh_script} ]]
	then
		local names

		names=$( \
			sed \
				-e "s/^[[:space:]]*--exclude[[:space:]]\{1,\}\([^[:space:]\\\\]*\).*/\1/p" \
				-n \
				"${refresh_script}" | \
			sed -e "s/\./\\\\./g" -e "s/\*/[^\/]*/g" | \
			paste -d "|" -s -)

		if [[ -z ${names} ]]
		then
			_exit_with_error "Unable to find an \"--exclude\" pattern in workspaces/refresh_other_workspaces.sh"
		fi

		owned_paths_regex="^workspaces/${2}/(.*/)?(${names})(/|$)"
	fi

	if [[ $(basename "${1}") == generated-file.md ]]
	then
		grep "^workspaces/${2}/" | grep --extended-regexp --invert-match "${owned_paths_regex}"
	else
		grep --extended-regexp "${owned_paths_regex}"
	fi
}

main "${@}"
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall