diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..79fe802 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +insert_final_newline = true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..871f27b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,29 @@ +name: Lint + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + shfmt: + name: shell formatting (shfmt) + runs-on: ubuntu-latest + env: + SHFMT_VERSION: v3.10.0 + steps: + - uses: actions/checkout@v4 + + - name: Install shfmt + run: | + curl -fsSL \ + "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_amd64" \ + -o /usr/local/bin/shfmt + chmod +x /usr/local/bin/shfmt + shfmt --version + + - name: Check formatting + run: shfmt -d . diff --git a/build.sh b/build.sh index 45419f0..3a9cca4 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ assets=$INPUT_ASSETS asset_dir=$INPUT_ASSET_DIR updpkgsums=$INPUT_UPDPKGSUMS test=$INPUT_TEST -read -r -a test_flags <<< "$INPUT_TEST_FLAGS" +read -r -a test_flags <<<"$INPUT_TEST_FLAGS" post_process=$INPUT_POST_PROCESS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL @@ -114,17 +114,17 @@ fi echo '::endgroup::' if [ "$updpkgsums" == "true" ]; then - echo '::group::Updating checksums' - cd /tmp/local-repo/ - updpkgsums - echo '::endgroup::' + echo '::group::Updating checksums' + cd /tmp/local-repo/ + updpkgsums + echo '::endgroup::' fi if [ "$test" == "true" ]; then - echo '::group::Building package with makepkg' - cd /tmp/local-repo/ - makepkg "${test_flags[@]}" - echo '::endgroup::' + echo '::group::Building package with makepkg' + cd /tmp/local-repo/ + makepkg "${test_flags[@]}" + echo '::endgroup::' fi echo '::group::Generating .SRCINFO' @@ -133,10 +133,10 @@ makepkg --printsrcinfo >.SRCINFO echo '::endgroup::' if [ -n "$post_process" ]; then - echo '::group::Executing post process commands' - cd /tmp/local-repo/ + echo '::group::Executing post process commands' + cd /tmp/local-repo/ eval "$post_process" - echo '::endgroup::' + echo '::endgroup::' fi echo '::group::Committing files to the repository' diff --git a/entrypoint.sh b/entrypoint.sh index 28bc51d..ce39172 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,7 +6,7 @@ echo '::group::Creating builder user' useradd --create-home --shell /bin/bash builder passwd --delete builder mkdir -p /etc/sudoers.d/ -echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/builder +echo "builder ALL=(root) NOPASSWD:ALL" >/etc/sudoers.d/builder echo '::endgroup::' echo '::group::Initializing SSH directory'