Merge 48f3917716df970b7b335941a5a4818e1dbbb7fa into 483689a71cf9d3a0bbdd79d23e00646ef4124391

This commit is contained in:
guzhongren 2022-01-22 15:53:08 +08:00 committed by GitHub
commit 5dfada73e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 2 deletions

30
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,30 @@
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: shell check
run: docker-compose run --rm shellcheck ./validate.sh

8
docker-compose.yaml Normal file
View File

@ -0,0 +1,8 @@
---
version: '3.9'
services:
shellcheck:
image: koalaman/shellcheck-alpine:latest
volumes:
- ".:/build"
working_dir: /build

View File

@ -1,10 +1,10 @@
#!/bin/sh -l
#!/bin/sh
# shellcheck disable=SC3060
set -e # if a command fails it stops the execution
set -u # script fails if trying to access to an undefined variable
echo "[+] Action start"
SOURCE_BEFORE_DIRECTORY="${1}"
SOURCE_DIRECTORY="${2}"
DESTINATION_GITHUB_USERNAME="${3}"
DESTINATION_REPOSITORY_NAME="${4}"

13
validate.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# shellcheck disable=SC2044
set -eu pipefile
rc=0
for filename in $(find ./* -name '*.sh'); do
echo "Start to validating ${filename}"
shellcheck "${filename}" || exit $?
echo "🚀Successfully Validated ${filename}"
done
exit $rc