Skip to content

Commit 0ee6aea

Browse files
github-actions[bot]github-actionsfabasoad
authored
Bump rhysd/actionlint from 1.7.5 to 1.7.6 (#22)
## Changelog - Update license copyright year to 2025 --- Powered by [FantasticFiasco/action-update-license-year](https://github.com/FantasticFiasco/action-update-license-year) --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: fabasoad <fabasoad@gmail.com>
1 parent e22dfc5 commit 0ee6aea

File tree

10 files changed

+114
-52
lines changed

10 files changed

+114
-52
lines changed

.github/workflows/functional-tests.yml

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on: # yamllint disable-line rule:truthy
55
pull_request:
66
paths:
77
- .github/workflows/functional-tests.yml
8+
- src/**
89
- action.yml
910
push:
1011
branches:
@@ -26,17 +27,21 @@ jobs:
2627
outputs:
2728
versions: ${{ steps.prepare-list.outputs.versions }}
2829
steps:
30+
- name: Get releases
31+
id: github-releases
32+
uses: yakubique/github-releases@v1.2
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
repository: "ciao-lang/ciao"
37+
sort: "desc"
2938
- name: Prepare list
3039
id: prepare-list
3140
env:
3241
RELEASES_AMOUNT: "3"
33-
TARGET_REPO: "ciao-lang/ciao"
3442
run: |
35-
versions=$(curl -sL \
36-
-H "Accept: application/vnd.github+json" \
37-
-H "X-GitHub-Api-Version: 2022-11-28" \
38-
"https://api.github.com/repos/${TARGET_REPO}/releases" \
39-
| jq -c -r --arg n "${RELEASES_AMOUNT}" '[.[0:($n | tonumber)][].tag_name] | map(sub("^v"; "")) | . += ["latest"]')
43+
versions=$(echo '${{ steps.github-releases.outputs.releases }}' \
44+
| jq -c -r --arg n "${RELEASES_AMOUNT}" '.[0:($n | tonumber)] | map(sub("^v"; "")) | . += ["latest"]')
4045
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
4146
setup-ciao:
4247
name: Setup Ciao
@@ -64,39 +69,11 @@ jobs:
6469
exit 1
6570
fi
6671
}
67-
test_equal "Wrong completion status" \
68-
"${{ steps.setup-ciao.outcome }}" \
69-
"success"
70-
test_equal "ciao should not be installed" \
72+
test_equal "ciao should be installed" \
7173
"${{ steps.setup-ciao.outputs.installed }}" \
7274
"true"
7375
- name: Run command
7476
run: ciao list
75-
windows-not-supported:
76-
name: Windows not supported
77-
runs-on: windows-latest
78-
timeout-minutes: 5
79-
steps:
80-
- name: Checkout ${{ github.repository }}
81-
uses: actions/checkout@v4
82-
- name: Setup Ciao
83-
id: setup-ciao
84-
continue-on-error: true
85-
uses: ./
86-
- name: Test action completion
87-
run: |
88-
test_equal() {
89-
if [ "${2}" != "${3}" ]; then
90-
echo "::error title=${1}::Expected: ${3}. Actual: ${2}."
91-
exit 1
92-
fi
93-
}
94-
test_equal "Wrong completion status" \
95-
"${{ steps.setup-ciao.outcome }}" \
96-
"failure"
97-
test_equal "ciao should not be installed" \
98-
"${{ steps.setup-ciao.outputs.installed }}" \
99-
"false"
10077
test-force:
10178
name: Test force
10279
runs-on: ubuntu-latest

.github/workflows/security.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ jobs:
1414
contents: read
1515
security-events: write
1616
uses: fabasoad/reusable-workflows/.github/workflows/wf-security-sast.yml@main
17+
with:
18+
code-scanning: true
19+
sca: true

.github/workflows/update-license.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: License
33

44
on: # yamllint disable-line rule:truthy
55
schedule:
6+
# Every January 1st at 14:00 JST
67
- cron: "0 5 1 1 *"
78

89
jobs:

.pre-commit-config.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- id: detect-secrets
2424
stages: ["pre-commit", "pre-push"]
2525
- repo: https://github.com/gitleaks/gitleaks
26-
rev: v8.22.0
26+
rev: v8.22.1
2727
hooks:
2828
- id: gitleaks
2929
stages: ["pre-commit", "pre-push"]
@@ -40,6 +40,13 @@ repos:
4040
rev: v0.43.0
4141
hooks:
4242
- id: markdownlint-fix
43+
# Shell
44+
- repo: https://github.com/openstack/bashate
45+
rev: 2.1.1
46+
hooks:
47+
- id: bashate
48+
args: ["-i", "E003,E006"]
49+
stages: ["pre-commit"]
4350
# Yaml
4451
- repo: https://github.com/adrienverge/yamllint
4552
rev: v1.35.1
@@ -48,7 +55,7 @@ repos:
4855
stages: ["pre-push"]
4956
# GitHub Actions
5057
- repo: https://github.com/rhysd/actionlint
51-
rev: v1.7.5
58+
rev: v1.7.6
5259
hooks:
5360
- id: actionlint
5461
args: ["-pyflakes="]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022-2024 Yevhen Fabizhevskyi
3+
Copyright (c) 2022-2025 Yevhen Fabizhevskyi
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ None.
3232
# (Optional) If "false" skips installation if ciao is already installed. If
3333
# "true" installs ciao in any case. Defaults to "false".
3434
force: "false"
35+
# (Optional) GitHub token that is used to send requests to GitHub API such
36+
# as getting latest release. Defaults to the token provided by GitHub Actions
37+
# environment.
38+
github-token: "${{ github.token }}"
3539
```
3640
3741
## Outputs

action.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ inputs:
1616
installs ciao in any case. Defaults to "false".
1717
required: false
1818
default: "false"
19+
github-token:
20+
description: |
21+
GitHub token that is used to send requests to GitHub API such as getting
22+
latest release. Defaults to the token provided by GitHub Actions environment.
23+
required: false
24+
default: ${{ github.token }}
1925
outputs:
2026
installed:
2127
description: Whether ciao was installed or not.
@@ -29,32 +35,33 @@ runs:
2935
echo "::error title=OS is not supported::${RUNNER_OS} ${RUNNER_ARCH} is not supported"
3036
exit 1
3137
shell: sh
38+
3239
- name: Collect info
3340
id: info
3441
env:
3542
INPUT_FORCE: "${{ inputs.force }}"
36-
run: |
37-
if [ "${INPUT_FORCE}" = "false" ] && command -v ciao >/dev/null 2>&1; then
38-
bin_installed="true"
39-
else
40-
bin_installed="false"
41-
fi
42-
echo "bin-installed=${bin_installed}" >> "$GITHUB_OUTPUT"
43-
44-
bin_dir="ciao_$(date +%s)"
45-
echo "bin-dir=${bin_dir}" >> "$GITHUB_OUTPUT"
43+
run: ./collect-info.sh "${INPUT_FORCE}"
44+
shell: sh
45+
working-directory: "${{ github.action_path }}/src"
4646

47-
bin_path="$GITHUB_WORKSPACE/${bin_dir}"
48-
echo "bin-path=${bin_path}" >> "$GITHUB_OUTPUT"
47+
- name: Get latest release
48+
if: ${{ steps.info.outputs.bin-installed == 'false' && inputs.version == 'latest' }}
49+
id: latest-release
50+
env:
51+
INPUT_GITHUB_TOKEN: "${{ inputs.github-token }}"
52+
run: ./get-latest-release.sh "ciao-lang/ciao" "${INPUT_GITHUB_TOKEN}"
4953
shell: sh
50-
- name: Download Ciao
54+
working-directory: "${{ github.action_path }}/src"
55+
56+
- name: Download ciao
5157
if: ${{ steps.info.outputs.bin-installed == 'false' }}
5258
uses: actions/checkout@v4
5359
with:
5460
repository: "ciao-lang/ciao"
55-
ref: ${{ inputs.version == 'latest' && 'master' || format('v{0}', inputs.version) }}
61+
ref: ${{ format('v{0}', inputs.version == 'latest' && steps.latest-release.outputs.version || inputs.version) }}
5662
fetch-depth: 1
5763
path: ${{ steps.info.outputs.bin-dir }}
64+
5865
- name: Install Ciao
5966
if: ${{ steps.info.outputs.bin-installed == 'false' }}
6067
id: install-ciao

src/collect-info.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env sh
2+
3+
SCRIPT_PATH=$(realpath "$0")
4+
SRC_DIR_PATH=$(dirname "$SCRIPT_PATH")
5+
LIB_DIR_PATH="${SRC_DIR_PATH}/lib"
6+
7+
. "${LIB_DIR_PATH}/logging.sh"
8+
9+
main() {
10+
input_force="${1}"
11+
12+
bin_installed="false"
13+
if command -v ciao >/dev/null 2>&1; then
14+
if [ "${input_force}" = "false" ]; then
15+
msg="Installation skipped."
16+
bin_installed="true"
17+
else
18+
msg="Executing forced installation."
19+
fi
20+
log_info "ciao is found at $(which ciao). ${msg}"
21+
else
22+
log_info "ciao is not found. Executing installation."
23+
fi
24+
echo "bin-installed=${bin_installed}" >> "$GITHUB_OUTPUT"
25+
26+
bin_dir="ciao_$(date +%s)"
27+
echo "bin-dir=${bin_dir}" >> "$GITHUB_OUTPUT"
28+
29+
bin_path="$GITHUB_WORKSPACE/${bin_dir}"
30+
echo "bin-path=${bin_path}" >> "$GITHUB_OUTPUT"
31+
}
32+
33+
main "$@"

src/get-latest-release.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env sh
2+
3+
main() {
4+
repo="${1}"
5+
token="${2}"
6+
7+
version=$(curl -sL \
8+
-H "Accept: application/vnd.github+json" \
9+
-H "Authorization: Bearer ${token}" \
10+
-H "X-GitHub-Api-Version: 2022-11-28" \
11+
"https://api.github.com/repos/${repo}/releases/latest" \
12+
| jq -r '.tag_name | sub("^v"; "")')
13+
echo "version=${version}" >> "$GITHUB_OUTPUT"
14+
}
15+
16+
main "$@"

src/lib/logging.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env sh
2+
3+
# Printing log to the console.
4+
# Parameters:
5+
# 1. (Required) Log level. Options: debug, info, warning, error.
6+
# 2. (Required) Message.
7+
log() {
8+
header="setup-ciao-action"
9+
printf "[%s] [%s] %s %s\n" "${1}" "${header}" "$(date +'%Y-%m-%d %T')" "${2}" 1>&2
10+
}
11+
12+
log_info() {
13+
log "info" "${1}"
14+
}

0 commit comments

Comments
 (0)