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

Add support to run action on self-hosted runner #90

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,28 @@ If running the latest stable version of Shellcheck is not to your liking, you ca
with:
version: v0.9.0
```

## Run Spellcheck in self-hosted runner

To run Spellcheck in self-hosted container, first need to add all OS requirements based on container image used.
(For Rockylinux 8 image, xz and findutils for example)

```yaml
on: push

name: "Trigger: Push action"

jobs:
shellcheck:
name: Shellcheck
runs-on: [self-hosted, rocky]
container: rockylinux:8
steps:
- uses: actions/checkout@v3
- name: OS packages
run: |
dnf install xz findutils -y
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
```

14 changes: 7 additions & 7 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ runs:

baseurl="https://github.com/koalaman/shellcheck/releases/download"

curl -Lso "${{ github.action_path }}/sc.tar.xz" \
curl -Lso "${GITHUB_ACTION_PATH}/sc.tar.xz" \
"${baseurl}/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.${osvariant}.x86_64.tar.xz"

tar -xf "${{ github.action_path }}/sc.tar.xz" -C "${{ github.action_path }}"
mv "${{ github.action_path }}/shellcheck-${INPUT_VERSION}/shellcheck" \
"${{ github.action_path }}/shellcheck"
tar -xf "${GITHUB_ACTION_PATH}/sc.tar.xz" -C "${GITHUB_ACTION_PATH}"
mv "${GITHUB_ACTION_PATH}/shellcheck-${INPUT_VERSION}/shellcheck" \
"${GITHUB_ACTION_PATH}/shellcheck"

- name: Display shellcheck version
shell: bash
run: |
"${{ github.action_path }}/shellcheck" --version
"${GITHUB_ACTION_PATH}/shellcheck" --version

- name: Set options
shell: bash
Expand Down Expand Up @@ -204,12 +204,12 @@ runs:
-print0)

if [[ -n "${INPUT_CHECK_TOGETHER}" ]]; then
"${{ github.action_path }}/shellcheck" \
"${GITHUB_ACTION_PATH}/shellcheck" \
${INPUT_SHELLCHECK_OPTIONS} \
"${filepaths[@]}" || statuscode=$?
else
for file in "${filepaths[@]}"; do
"${{ github.action_path }}/shellcheck" \
"${GITHUB_ACTION_PATH}/shellcheck" \
${INPUT_SHELLCHECK_OPTIONS} \
"$file" || statuscode=$?
done
Expand Down