mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 00:19:36 -05:00
07c884b945
* ci: remove artifact encryption for public artifacts * revert parts of #2765 * ci: add unused action exception for encrypted artifact download
60 lines
1.1 KiB
Bash
Executable File
60 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
###### script header ######
|
|
|
|
lib=$(realpath @@BASE_LIB@@) || exit 1
|
|
stat "${lib}" >> /dev/null || exit 1
|
|
|
|
# shellcheck source=../sh/lib.bash
|
|
if ! source "${lib}"; then
|
|
echo "Error: could not find import"
|
|
exit 1
|
|
fi
|
|
|
|
cd "${BUILD_WORKSPACE_DIRECTORY}"
|
|
|
|
###### script body ######
|
|
|
|
# Find all action YAMLs. This action check if there are files within
|
|
# .github/actions that are not used in any workflow or action YAML.
|
|
# We only want directory of that exact level and ignore subdirectories.
|
|
actionNames=$(
|
|
find .github/actions \
|
|
-maxdepth 2 \
|
|
-type d \
|
|
! -name actions
|
|
)
|
|
|
|
actionYMLs=$(
|
|
find .github/actions \
|
|
! -name actions \
|
|
-type f \
|
|
-name '*.yml'
|
|
)
|
|
|
|
workflowYMLs=$(
|
|
find .github/workflows \
|
|
-type f \
|
|
-name '*.yml'
|
|
)
|
|
|
|
exitcode=0
|
|
|
|
for action in ${actionNames}; do
|
|
used=false
|
|
|
|
for yml in ${actionYMLs} ${workflowYMLs}; do
|
|
if grep -q "${action}" "${yml}"; then
|
|
used=true
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [[ ${used} == "false" && ${action} != ".github/actions/artifact_download" ]]; then
|
|
echo "Action ${action} is unused"
|
|
exitcode=1
|
|
fi
|
|
done
|
|
|
|
exit "${exitcode}"
|