Skip to content

Commit

Permalink
Merge pull request #176 from nathanielvarona/improvement-step-outputs…
Browse files Browse the repository at this point in the history
…-logs-formating

Step Outputs Logs Formating
  • Loading branch information
nathanielvarona authored May 6, 2024
2 parents 986248c + 22b4714 commit c332c94
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ Configure the **Pritunl Client GitHub Action** using a declarative syntax, makin

* `client-id` — a string representing the primary client ID, which is a single identifier generated during the profile setup process.
- Example:
```
client_id="6p5yiqbkjbktkrz5"
```text
6p5yiqbkjbktkrz5
```
* `client-ids` — a JSON array containing all client IDs and names in the profile, with each entry represented as a key-value pair (e.g., `{"id":"client_id","name":"profile_name"}`).

- Example _(single entry)_:
```
client-ids="[{"id":"6p5yiqbkjbktkrz5","name":"gha-automator-dev (dev-team)"}]"
```json
[{"id":"6p5yiqbkjbktkrz5","name":"gha-automator-dev (dev-team)"}]
```
- Example _(multiple entries)_:
```
client-ids="[{"id":"kp4kx4zbcqpsqkbk","name":"gha-automator-qa2 (dev-team)"},{"id":"rsy6npzw5mwryge2","name":"gha-automator-qa2 (qa-team)"}]"
```json
[{"id":"kp4kx4zbcqpsqkbk","name":"gha-automator-qa2 (dev-team)"},{"id":"rsy6npzw5mwryge2","name":"gha-automator-qa2 (qa-team)"}]
```


Expand Down
25 changes: 20 additions & 5 deletions pritunl-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ PRITUNL_CONCEALED_OUTPUTS="${PRITUNL_CONCEALED_OUTPUTS:-}" # Concealed Outputs

# Visual Feedback with Emoji Bytes and Color Codes
# ---------------------------------------------------------------
# Emojis
TTY_EMOJI_PACKAGE='\xF0\x9F\x93\xA6' # Package emoji
TTY_EMOJI_SCROLL='\xF0\x9F\x93\x9C' # Scroll emoji
# Color Codes
TTY_RED_NORMAL='\033[0;31m' # Normal red color
TTY_RED_BOLD='\033[1;31m' # Bold red color
TTY_GREEN_NORMAL='\033[0;32m' # Normal green color
Expand All @@ -36,10 +38,13 @@ TTY_YELLOW_NORMAL='\033[0;33m' # Normal yellow color
TTY_YELLOW_BOLD='\033[1;33m' # Bold yellow color
TTY_BLUE_NORMAL='\033[0;34m' # Normal blue color
TTY_BLUE_BOLD='\033[1;34m' # Bold blue color
# Gray Colors
TTY_GRAY_NORMAL='\033[0;37m' # Normal gray color
TTY_GRAY_BOLD='\033[1;90m' # Bold gray color
# Color Reset
TTY_COLOR_RESET='\033[0m' # Reset terminal color
# ---------------------------------------------------------------


# Installation process for Linux
install_for_linux() {
# This function contains code to install the Pritunl client on Linux.
Expand Down Expand Up @@ -365,11 +370,21 @@ setup_profile_file() {
echo -e "${TTY_EMOJI_SCROLL} The profile has been configured, ${TTY_BLUE_NORMAL}step outputs${TTY_COLOR_RESET} generated, and profile $(pluralize_word $profile_server_count "server") are now ready for connection establishment."

if [[ "${PRITUNL_CONCEALED_OUTPUTS}" != "true" ]]; then
# Display Primary Client ID (string, bash variable)
echo -e "${TTY_BLUE_NORMAL}client-id${TTY_COLOR_RESET}=\"${TTY_GREEN_NORMAL}$client_id${TTY_COLOR_RESET}\""
# Display header with yellow color
echo -e "${TTY_YELLOW_NORMAL}Action Step Outputs${TTY_COLOR_RESET}"
# Display horizontal rule with gray color, separating header from content
echo -e "${TTY_GRAY_NORMAL}-------------------${TTY_COLOR_RESET}"

# Display Primary Client ID (string, bash variable) with blue and green colors
# client-id is displayed in blue, followed by the actual ID in green
echo -e "${TTY_BLUE_NORMAL}client-id${TTY_COLOR_RESET}: ${TTY_GREEN_NORMAL}$client_id${TTY_COLOR_RESET}"

# Display All Client IDs and Names (JSON array) with blue color
# client-ids is displayed in blue, followed by the JSON array of IDs and names
echo -e "${TTY_BLUE_NORMAL}client-ids${TTY_COLOR_RESET}: $(echo $client_ids | jq -cC )"

# Display All Client IDs and Names (JSON array)
echo -e "${TTY_BLUE_NORMAL}client-ids${TTY_COLOR_RESET}=\"$(echo $client_ids | jq -cC )\""
# Display horizontal rule with gray color, separating content from footer
echo -e "${TTY_GRAY_NORMAL}-------------------${TTY_COLOR_RESET}"
else
echo -e "${TTY_YELLOW_NORMAL}Step outputs are concealed. Set 'concealed-outputs' to 'false' in the action inputs to reveal.${TTY_COLOR_RESET}"
fi
Expand Down

0 comments on commit c332c94

Please sign in to comment.