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

#345: make popular options transmission directly to YAML configuration #396

Merged
merged 1 commit into from
Oct 24, 2024
Merged
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ entry: target/docker-image.txt
-e "INPUT_VERBOSE=true" \
-e "INPUT_PAGES=pages" \
-e "INPUT_TOKEN=00000000-0000-0000-0000-000000000000" \
-e "INPUT_GITHUB_TOKEN=00000000-0000-0000-0000-000000000000" \
-e "INPUT_OPTIONS=$$(cat target/opts.txt)" \
"$${img}"
echo "$$?" > target/entry.exit
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ jobs:
- uses: zerocracy/[email protected]
with:
token: ${{ secrets.ZEROCRACY_TOKEN }}
options: |
github_token=${{ secrets.GITHUB_TOKEN }}
repositories=...
github_token: ${{ secrets.GITHUB_TOKEN }}
repositories: yegor256/judges,yegor256/factbase,zerocracy/*
factbase: foo.fb
- uses: zerocracy/[email protected]
with:
Expand Down Expand Up @@ -78,6 +77,13 @@ The following options are expected by the plugin
* `options` (mandatory) is a list of `k=v` pairs, which are explained below
* `factbase` (mandatory) is the path of the [Factbase][factbase] file
(where everything is kept)
* `repositories` (optional) is a comma-separated list of masks that
determine the repositories to manage, where
`yegor256/*` means all repos of the user,
`yegor256/judges` means a specific repo,
and
`-yegor256/judges` means an exclusion of the repo from the list.
* `github_token` (optional) is an authentication GitHub access token
* `verbose` (optional) makes it print debugging info if set to `true`
* `cycles` (optional) is a number of update cycles to run

Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ inputs:
options:
description: 'Command line options for the "judges" tool'
required: false
repositories:
description: 'Comma-separated list of masks that determine the repositories to manage'
required: false
github_token:
description: 'Authentication GitHub access token'
required: false
verbose:
description: 'Log as much debug information as possible'
required: false
Expand Down
11 changes: 10 additions & 1 deletion entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ GITHUB_REPO_NAME="${GITHUB_REPOSITORY#"${GITHUB_REPOSITORY_OWNER}/"}"
VITALS_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPO_NAME}/${name}-vitals.html"

# Add new facts, using the judges (Ruby scripts) in the /judges directory
declare -A optionmap=(
["repositories"]="${INPUT_REPOSITORIES}"
["github_token"]="${INPUT_GITHUB_TOKEN}"
)
declare -a options=()
while IFS= read -r o; do
s=$(echo "${o}" | xargs)
Expand All @@ -93,8 +97,13 @@ while IFS= read -r o; do
VITALS_URL="${v}"
continue
fi
options+=("--option=${k}=${v}")
optionmap[$k]=$v
done <<< "${INPUT_OPTIONS}"
for k in "${!optionmap[@]}"; do
if [ -n "${optionmap[$k]}" ]; then
options+=("--option=${k}=${optionmap[$k]}");
fi
done
options+=("--option=judges_action_version=${VERSION}")
options+=("--option=vitals_url=${VITALS_URL}")

Expand Down