Skip to content

Commit

Permalink
2022.12.11:
Browse files Browse the repository at this point in the history
* new: bash/_common: added `source-and-call.sh` script to be able to source a script and call a function from another shell script
* changed: TODO.txt: todo update
  • Loading branch information
andry81 committed Dec 11, 2022
1 parent 8ace8ad commit 7dc44c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
12 changes: 1 addition & 11 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
fi

value="${value//[ $'\t'a-zA-Z]/}"
value_int="${value%.*}"
value_int="${value%%.*}"
value_fract="${value#*.}"
[[ "$value_fract" == "$value" ]] && value_fract=0
(( value_int || value_fract )) && exit 0
Expand Down Expand Up @@ -238,16 +238,6 @@
- file: bbb-xxx.svg
query-url: https://github.com/andry81-cache/andry81-devops--gh-content-cache/blob/master/repo/andry81-devops/gh-workflow/badges/metrics/tokei-lines-of-code.svg

* Duplicate commit url into `changelog.txt` additionally to a pipeline log for
all `*--gh-stats` repositories. This will add access to a commit from a
changelog in case of pipeline log absence because of it's expiration.

Example:

YYYY-MM-DD:
* notice: GitHub Actions Run: https://github.com/andry81-devops/andry81-devops/actions/runs/3595313872 # 1608
* notice: Commit Reference URL: https://github.com/andry81-cache/andry81-devops--gh-content-cache/commit/3ad502b8678204bfe569ecec2e449757ec3528cc

* Modificate `query-url` parameter in the `content-index.yml` file from
`bash/cache/accum-content.sh` script to be able to extract it's components
into variables and address them in code blocks. Add `expand` parameter to
Expand Down
17 changes: 17 additions & 0 deletions bash/_common/source-and-call.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Script can be ONLY executed.
[[ -z "$BASH" || (-n "$BASH_LINENO" && BASH_LINENO[0] -gt 0) ]] && return

[[ -z "$GH_WORKFLOW_ROOT" ]] && {
echo "$0: error: \`GH_WORKFLOW_ROOT\` variable must be defined." >&2
exit 255
}

# first parameter is source file
if [[ -n "$1" && "$1" != '.' ]]; then
source "$1" || exit $?
fi

# second parameter to call with arguments, execute unconditionally
$2 "${@:3}"
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2022.12.11:
* new: bash/_common: added `source-and-call.sh` script to be able to source a script and call a function from another shell script
* changed: TODO.txt: todo update

2022.12.11:
* changed: bash/github/accum-stats.sh: duplicate `count_decinc` and `uniques_decinc` fields from `by_year` json into `latest-accum.json`

Expand Down

0 comments on commit 7dc44c5

Please sign in to comment.