chore(lint): Linted scripts, yaml and configs

This commit is contained in:
2023-07-27 13:57:15 +03:00
parent a864d31e84
commit d7106ae28f
11 changed files with 30 additions and 50 deletions

View File

@@ -1,6 +1,5 @@
version: 2 version: 2
updates: updates:
# Maintain dependencies for GitHub Actions # Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"

View File

@@ -1,22 +1,17 @@
---
name: Debug Changelog # Workflow name displayed on GitHub name: Debug Changelog # Workflow name displayed on GitHub
on: on:
workflow_dispatch: # Trigger manually workflow_dispatch: # Trigger manually
jobs: jobs:
debug-changelog: debug-changelog:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Create changelog text - name: Create changelog text
id: changelog id: changelog
uses: loopwerk/tag-changelog@v1 uses: loopwerk/tag-changelog@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog-config.js config_file: .github/tag-changelog-config.js
- name: "Echo results" - name: "Echo results"
id: output-changelog id: output-changelog
run: | run: |

View File

@@ -1,14 +1,10 @@
---
name: Release Daily State # Workflow name displayed on GitHub name: Release Daily State # Workflow name displayed on GitHub
on: on:
workflow_dispatch: # Trigger manually workflow_dispatch: # Trigger manually
schedule: schedule:
- cron: "30 20 * * *" # UTC is 2-3 hours behind Europe/Helsinki, my timezone - cron: "30 20 * * *" # UTC is 2-3 hours behind Europe/Helsinki, my timezone
permissions: permissions:
contents: write contents: write
jobs: jobs:
new-daily-release: new-daily-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -17,11 +13,9 @@ jobs:
version: ${{ steps.daily-version.outputs.version }} version: ${{ steps.daily-version.outputs.version }}
steps: steps:
- uses: actions/checkout@v3 # Checkout our working repository - uses: actions/checkout@v3 # Checkout our working repository
- name: Create tag if necessary - name: Create tag if necessary
uses: fregante/daily-version-action@v2 uses: fregante/daily-version-action@v2
id: daily-version id: daily-version
- name: Create changelog text - name: Create changelog text
if: steps.daily-version.outputs.created if: steps.daily-version.outputs.created
id: changelog id: changelog
@@ -29,7 +23,6 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog-config.js config_file: .github/tag-changelog-config.js
- name: Create release - name: Create release
if: steps.daily-version.outputs.created if: steps.daily-version.outputs.created
uses: actions/create-release@latest uses: actions/create-release@latest

View File

@@ -1,13 +1,11 @@
name: Update submodules name: Update submodules
on: on:
schedule: [cron: 0 3 * * *] schedule: [{cron: 0 3 * * *}]
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: write contents: write
issues: write issues: write
pull-requests: write pull-requests: write
jobs: jobs:
update-submodules: update-submodules:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -18,12 +16,10 @@ jobs:
submodules: true submodules: true
fetch-depth: 0 fetch-depth: 0
token: ${{secrets.GITHUB_TOKEN}} token: ${{secrets.GITHUB_TOKEN}}
- name: Config Git User - name: Config Git User
run: | run: |
git config --global user.name "${{ github.actor }}" git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com" git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update submodules - name: Update submodules
run: | run: |
if git commit -am"chore(git): Update submodules (automated) if git commit -am"chore(git): Update submodules (automated)

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck source="../scripts/shared.sh" # shellcheck source="../scripts/shared.sh"
# shellcheck disable=1091,2139
source "$DOTFILES/scripts/shared.sh" source "$DOTFILES/scripts/shared.sh"
# Get installed php versions from brew and setup aliases # Get installed php versions from brew and setup aliases

View File

@@ -1,24 +1,19 @@
---
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL. # The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
# editor: $EDITOR # editor: $EDITOR
# Should 'cheat' always colorize output? # Should 'cheat' always colorize output?
colorize: true colorize: true
# Which 'chroma' colorscheme should be applied to the output? # Which 'chroma' colorscheme should be applied to the output?
# Options are available here: # Options are available here:
# https://github.com/alecthomas/chroma/tree/master/styles # https://github.com/alecthomas/chroma/tree/master/styles
style: "catppuccin" style: "catppuccin"
# Which 'chroma' "formatter" should be applied? # Which 'chroma' "formatter" should be applied?
# One of: "terminal", "terminal256", "terminal16m" # One of: "terminal", "terminal256", "terminal16m"
formatter: terminal256 formatter: terminal256
# Through which pager should output be piped? # Through which pager should output be piped?
# 'less -FRX' is recommended on Unix systems # 'less -FRX' is recommended on Unix systems
# 'more' is recommended on Windows # 'more' is recommended on Windows
pager: less -FRX pager: less -FRX
# Cheatpaths are paths at which cheatsheets are available on your local # Cheatpaths are paths at which cheatsheets are available on your local
# filesystem. # filesystem.
# #
@@ -63,21 +58,21 @@ cheatpaths:
# 'readonly': shall user-created ('cheat -e') cheatsheets be saved here? # 'readonly': shall user-created ('cheat -e') cheatsheets be saved here?
- name: community - name: community
path: ~/.config/cheat/cheatsheets/community path: ~/.config/cheat/cheatsheets/community
tags: [ community ] tags: [community]
readonly: true readonly: true
# If you have personalized cheatsheets, list them last. They will take # If you have personalized cheatsheets, list them last. They will take
# precedence over the more global cheatsheets. # precedence over the more global cheatsheets.
- name: personal - name: personal
path: ~/.dotfiles/config/cheat/cheatsheets/personal path: ~/.dotfiles/config/cheat/cheatsheets/personal
tags: [ personal ] tags: [personal]
readonly: false readonly: false
- name: pure-bash-bible - name: pure-bash-bible
path: ~/.dotfiles/config/cheat/cheatsheets/pure-bash-bible path: ~/.dotfiles/config/cheat/cheatsheets/pure-bash-bible
tags: [ pure-bash-bible ] tags: [pure-bash-bible]
readonly: true readonly: true
- name: tldr - name: tldr
path: ~/.dotfiles/config/cheat/cheatsheets/tldr path: ~/.dotfiles/config/cheat/cheatsheets/tldr
tags: [ tldr ] tags: [tldr]
readonly: true readonly: true
# While it requires no configuration here, it's also worth noting that # While it requires no configuration here, it's also worth noting that

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# shellcheck enable=external-sources # shellcheck enable=external-sources
# shellcheck disable=1091 # shellcheck disable=1091,2139
# vim: filetype=zsh # vim: filetype=zsh
source "$DOTFILES/scripts/shared.sh" source "$DOTFILES/scripts/shared.sh"

View File

@@ -5,7 +5,8 @@
# #
# Modified by Ismo Vuorinen <https://github.com/ivuorinen> 2023 # Modified by Ismo Vuorinen <https://github.com/ivuorinen> 2023
__pushover_usage() { __pushover_usage()
{
printf "pushover <options> <message>\n" printf "pushover <options> <message>\n"
printf " -c <callback>\n" printf " -c <callback>\n"
printf " -d <device>\n" printf " -d <device>\n"
@@ -22,7 +23,8 @@ __pushover_usage() {
return 1 return 1
} }
__pushover_opt_field() { __pushover_opt_field()
{
field=$1 field=$1
shift shift
value="${*}" value="${*}"
@@ -31,7 +33,8 @@ __pushover_opt_field() {
fi fi
} }
__pushover_send_message() { __pushover_send_message()
{
device="${1:-}" device="${1:-}"
curl_cmd="\"${CURL}\" -s -S \ curl_cmd="\"${CURL}\" -s -S \
@@ -71,8 +74,7 @@ devices="${devices} ${device}"
optstring="c:d:D:e:f:p:r:t:T:s:u:U:a:h" optstring="c:d:D:e:f:p:r:t:T:s:u:U:a:h"
OPTIND=1 OPTIND=1
while getopts ${optstring} c while getopts ${optstring} c; do
do
case ${c} in case ${c} in
c) c)
callback="${OPTARG}" callback="${OPTARG}"
@@ -117,7 +119,7 @@ do
;; ;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND - 1))
if [ "$#" -lt 1 ]; then if [ "$#" -lt 1 ]; then
__pushover_usage __pushover_usage
@@ -141,9 +143,8 @@ else
__pushover_send_message "${device}" __pushover_send_message "${device}"
r=${?} r=${?}
if [ "${r}" -ne 0 ]; then if [ "${r}" -ne 0 ]; then
break; break
fi fi
done done
fi fi
exit "${r}" exit "${r}"

View File

@@ -14,7 +14,8 @@ file_2="$2"
# return sha256sum for file # return sha256sum for file
# $1 - filename (string) # $1 - filename (string)
get_sha256sum() { get_sha256sum()
{
sha256sum "$1" | head -c 64 sha256sum "$1" | head -c 64
} }
@@ -22,11 +23,13 @@ get_sha256sum() {
echo "Usage: $0 file1.sh file2.sh" && exit 1 echo "Usage: $0 file1.sh file2.sh" && exit 1
} }
msg() { msg()
{
[[ "$VERBOSE" -eq 1 ]] && echo "$1" [[ "$VERBOSE" -eq 1 ]] && echo "$1"
} }
error() { error()
{
msg "(!) ERROR: $1" && exit 1 msg "(!) ERROR: $1" && exit 1
} }
@@ -45,6 +48,5 @@ if [ "$file_1_hash" != "$file_2_hash" ]; then
error "Files do not match" error "Files do not match"
else else
msg "(*) Success: Files do match" msg "(*) Success: Files do match"
exit 0; exit 0
fi fi

View File

@@ -6,7 +6,6 @@
# Helper env variables. Use like this: VERBOSE=1 ./script.sh # Helper env variables. Use like this: VERBOSE=1 ./script.sh
: "${VERBOSE:=0}" : "${VERBOSE:=0}"
# -- Colors -- # # -- Colors -- #
CLR_RED="\033[1;31m" CLR_RED="\033[1;31m"
CLR_YELLOW="\033[1;33m" CLR_YELLOW="\033[1;33m"
@@ -254,11 +253,11 @@ function replacable()
[[ ! -r "$FILE1" ]] && { [[ ! -r "$FILE1" ]] && {
[[ $VERBOSE -eq 1 ]] && msg_err "File 1 ($FILE1) does not exist" [[ $VERBOSE -eq 1 ]] && msg_err "File 1 ($FILE1) does not exist"
return 0; return 0
} }
[[ ! -r "$FILE2" ]] && { [[ ! -r "$FILE2" ]] && {
[[ $VERBOSE -eq 1 ]] && msg_err "File 2 ($FILE2) does not exist, replacable" [[ $VERBOSE -eq 1 ]] && msg_err "File 2 ($FILE2) does not exist, replacable"
return 1; return 1
} }
FILE1_HASH=$(get_sha256sum "$FILE1") FILE1_HASH=$(get_sha256sum "$FILE1")
@@ -266,20 +265,19 @@ function replacable()
[[ $FILE1_HASH = "" ]] && { [[ $FILE1_HASH = "" ]] && {
[[ $VERBOSE -eq 1 ]] && msg_err "Could not get hash for file 1 ($FILE1)" [[ $VERBOSE -eq 1 ]] && msg_err "Could not get hash for file 1 ($FILE1)"
return 0; return 0
} }
[[ $FILE2_HASH = "" ]] && { [[ $FILE2_HASH = "" ]] && {
[[ $VERBOSE -eq 1 ]] && msg_err "Could not get hash for file 2 ($FILE2), replacable" [[ $VERBOSE -eq 1 ]] && msg_err "Could not get hash for file 2 ($FILE2), replacable"
return 1; return 1
} }
[[ "$FILE1_HASH" == "$FILE2_HASH" ]] && { [[ "$FILE1_HASH" == "$FILE2_HASH" ]] && {
[[ $VERBOSE -eq 1 ]] && msg_ok "Files match, not replacable: $FILE1" [[ $VERBOSE -eq 1 ]] && msg_ok "Files match, not replacable: $FILE1"
return 0; return 0
} }
[[ $VERBOSE -eq 1 ]] && msg_warn "Files do not match ($FILE1_HASH != $FILE2_HASH), replacable" [[ $VERBOSE -eq 1 ]] && msg_warn "Files do not match ($FILE1_HASH != $FILE2_HASH), replacable"
return 1; return 1
} }

View File

@@ -4,6 +4,6 @@
link: link:
create: true create: true
relink: true relink: true
exclude: [ "*.md", "*renovate*", "LICENSE" ] exclude: ["*.md", "*renovate*", "LICENSE"]
shell: shell:
stdout: true stdout: true