From ec3b93581d8b30903f444617f8f32479578da4d0 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 7 Sep 2025 17:03:04 -0700 Subject: [PATCH] Standardize formatting of shell code in tasks and workflows Shell scripts in Arduino tooling projects are formatted according to the style implemented by the shfmt formatting tool. In addition to standalone script files, significant quantities of complex shell code is also found in the asset tasks and workflows. shfmt can not be used to format this code (both due to the fact it is in the form of strings in YAML documents, and due to the fact that it is actually templates of shell code (making use of the templating features of Task and GitHub Actions) rather than complete shell code). However, it still makes sense to align the formatting of this code with the standardized shell code style where doing so is feasible. --- .github/workflows/check-certificates.yml | 6 +++--- .github/workflows/check-general-formatting-task.yml | 6 +++--- .github/workflows/check-go-dependencies-task.yml | 2 +- .github/workflows/check-go-task.yml | 2 +- .github/workflows/check-license.yml | 2 +- .github/workflows/check-markdown-task.yml | 2 +- .github/workflows/check-mkdocs-task.yml | 2 +- .github/workflows/check-npm-task.yml | 2 +- .github/workflows/check-prettier-formatting-task.yml | 2 +- .github/workflows/check-python-task.yml | 2 +- .github/workflows/check-shell-task.yml | 10 +++++----- .../deploy-cobra-mkdocs-versioned-poetry.yml | 4 ++-- .github/workflows/publish-go-nightly-task.yml | 8 ++++---- .github/workflows/publish-go-tester-task.yml | 9 ++++----- .github/workflows/release-go-task.yml | 12 ++++++------ .github/workflows/spell-check-task.yml | 2 +- .github/workflows/sync-labels-npm.yml | 6 +++--- .github/workflows/test-go-integration-task.yml | 2 +- .github/workflows/test-go-task.yml | 2 +- .github/workflows/test-install.yml | 2 +- 20 files changed, 42 insertions(+), 43 deletions(-) diff --git a/.github/workflows/check-certificates.yml b/.github/workflows/check-certificates.yml index cfe56e368..0428c2d65 100644 --- a/.github/workflows/check-certificates.yml +++ b/.github/workflows/check-certificates.yml @@ -59,7 +59,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check-certificates: name: ${{ matrix.certificate.identifier }} @@ -82,7 +82,7 @@ jobs: - name: Set certificate path environment variable run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "CERTIFICATE_PATH=${{ runner.temp }}/certificate.p12" >> "$GITHUB_ENV" + echo "CERTIFICATE_PATH=${{ runner.temp }}/certificate.p12" >>"$GITHUB_ENV" - name: Decode certificate env: @@ -166,7 +166,7 @@ jobs: echo "Certificate expiration date: $EXPIRATION_DATE" echo "Days remaining before expiration: $DAYS_BEFORE_EXPIRATION" - echo "days=$DAYS_BEFORE_EXPIRATION" >> $GITHUB_OUTPUT + echo "days=$DAYS_BEFORE_EXPIRATION" >>$GITHUB_OUTPUT - name: Check if expiration notification period has been reached id: check-expiration diff --git a/.github/workflows/check-general-formatting-task.yml b/.github/workflows/check-general-formatting-task.yml index f707bd674..4a74b06b9 100644 --- a/.github/workflows/check-general-formatting-task.yml +++ b/.github/workflows/check-general-formatting-task.yml @@ -35,7 +35,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check: needs: run-determination @@ -48,7 +48,7 @@ jobs: - name: Set environment variables run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >> "$GITHUB_ENV" + echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >>"$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v5 @@ -76,7 +76,7 @@ jobs: mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec" # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path - echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH" + echo "${{ env.EC_INSTALL_PATH }}/bin" >>"$GITHUB_PATH" - name: Check formatting run: task --silent general:check-formatting diff --git a/.github/workflows/check-go-dependencies-task.yml b/.github/workflows/check-go-dependencies-task.yml index 950e6e726..f6f946409 100644 --- a/.github/workflows/check-go-dependencies-task.yml +++ b/.github/workflows/check-go-dependencies-task.yml @@ -53,7 +53,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check-cache: needs: run-determination diff --git a/.github/workflows/check-go-task.yml b/.github/workflows/check-go-task.yml index db88b243d..8ca6844f0 100644 --- a/.github/workflows/check-go-task.yml +++ b/.github/workflows/check-go-task.yml @@ -47,7 +47,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check-errors: name: check-errors (${{ matrix.module.path }}) diff --git a/.github/workflows/check-license.yml b/.github/workflows/check-license.yml index 5ecb9b14e..0c9d7982e 100644 --- a/.github/workflows/check-license.yml +++ b/.github/workflows/check-license.yml @@ -50,7 +50,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check-license: name: ${{ matrix.check-license.path }} diff --git a/.github/workflows/check-markdown-task.yml b/.github/workflows/check-markdown-task.yml index 40059161e..85973bdf6 100644 --- a/.github/workflows/check-markdown-task.yml +++ b/.github/workflows/check-markdown-task.yml @@ -63,7 +63,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT lint: needs: run-determination diff --git a/.github/workflows/check-mkdocs-task.yml b/.github/workflows/check-mkdocs-task.yml index 88bf7ffc7..f4d157376 100644 --- a/.github/workflows/check-mkdocs-task.yml +++ b/.github/workflows/check-mkdocs-task.yml @@ -65,7 +65,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check: needs: run-determination diff --git a/.github/workflows/check-npm-task.yml b/.github/workflows/check-npm-task.yml index 741e7bd94..17e93e8ca 100644 --- a/.github/workflows/check-npm-task.yml +++ b/.github/workflows/check-npm-task.yml @@ -47,7 +47,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT validate: name: validate (${{ matrix.project.path }}) diff --git a/.github/workflows/check-prettier-formatting-task.yml b/.github/workflows/check-prettier-formatting-task.yml index 2751f2385..89067cc6e 100644 --- a/.github/workflows/check-prettier-formatting-task.yml +++ b/.github/workflows/check-prettier-formatting-task.yml @@ -227,7 +227,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT check: needs: run-determination diff --git a/.github/workflows/check-python-task.yml b/.github/workflows/check-python-task.yml index 56fc562a0..29c0282d4 100644 --- a/.github/workflows/check-python-task.yml +++ b/.github/workflows/check-python-task.yml @@ -53,7 +53,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT lint: needs: run-determination diff --git a/.github/workflows/check-shell-task.yml b/.github/workflows/check-shell-task.yml index 2b513c0d5..f23f0e53b 100644 --- a/.github/workflows/check-shell-task.yml +++ b/.github/workflows/check-shell-task.yml @@ -47,7 +47,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT lint: name: ${{ matrix.configuration.name }} (${{ matrix.script }}) @@ -82,7 +82,7 @@ jobs: - name: Set environment variables run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "INSTALL_PATH=${{ runner.temp }}/shellcheck" >> "$GITHUB_ENV" + echo "INSTALL_PATH=${{ runner.temp }}/shellcheck" >>"$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v5 @@ -113,7 +113,7 @@ jobs: )" # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path - echo "${{ env.INSTALL_PATH }}/$EXTRACTION_FOLDER" >> "$GITHUB_PATH" + echo "${{ env.INSTALL_PATH }}/$EXTRACTION_FOLDER" >>"$GITHUB_PATH" - name: Run ShellCheck uses: liskin/gh-problem-matcher-wrap@v3 @@ -144,7 +144,7 @@ jobs: - name: Set environment variables run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "SHFMT_INSTALL_PATH=${{ runner.temp }}/shfmt" >> "$GITHUB_ENV" + echo "SHFMT_INSTALL_PATH=${{ runner.temp }}/shfmt" >>"$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v5 @@ -172,7 +172,7 @@ jobs: mv "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" "${{ env.SHFMT_INSTALL_PATH }}/shfmt" # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path - echo "${{ env.SHFMT_INSTALL_PATH }}" >> "$GITHUB_PATH" + echo "${{ env.SHFMT_INSTALL_PATH }}" >>"$GITHUB_PATH" - name: Format shell scripts run: | diff --git a/.github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml b/.github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml index 29b28b722..1ed25fc39 100644 --- a/.github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml +++ b/.github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml @@ -49,7 +49,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT publish: runs-on: ubuntu-latest @@ -96,7 +96,7 @@ jobs: - name: Determine versioning parameters id: determine-versioning - run: echo "data=$(poetry run python docs/siteversion/siteversion.py)" >> $GITHUB_OUTPUT + run: echo "data=$(poetry run python docs/siteversion/siteversion.py)" >>$GITHUB_OUTPUT - name: Publish documentation if: fromJson(steps.determine-versioning.outputs.data).version != null diff --git a/.github/workflows/publish-go-nightly-task.yml b/.github/workflows/publish-go-nightly-task.yml index b6ace96c7..a3a5f5721 100644 --- a/.github/workflows/publish-go-nightly-task.yml +++ b/.github/workflows/publish-go-nightly-task.yml @@ -93,7 +93,7 @@ jobs: - name: Set environment variables run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV" + echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >>"$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v5 @@ -111,7 +111,7 @@ jobs: # Arbitrary password for a keychain that exists only for the duration of the job, so not secret KEYCHAIN_PASSWORD: keychainpassword run: | - echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" + echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode >"${{ env.INSTALLER_CERT_MAC_PATH }}" security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" security default-keychain -s "${{ env.KEYCHAIN }}" security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" @@ -136,7 +136,7 @@ jobs: - name: Write gon config to file # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) run: | - cat > "${{ env.GON_CONFIG_PATH }}" <"${{ env.GON_CONFIG_PATH }}" < ${TAG}-checksums.txt + sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >${TAG}-checksums.txt - name: configure aws credentials uses: aws-actions/configure-aws-credentials@v5 diff --git a/.github/workflows/publish-go-tester-task.yml b/.github/workflows/publish-go-tester-task.yml index 110c40128..3178229e9 100644 --- a/.github/workflows/publish-go-tester-task.yml +++ b/.github/workflows/publish-go-tester-task.yml @@ -54,7 +54,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT package-name-prefix: needs: run-determination @@ -73,7 +73,7 @@ jobs: fi PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-" - echo "prefix=$PACKAGE_NAME_PREFIX" >> $GITHUB_OUTPUT + echo "prefix=$PACKAGE_NAME_PREFIX" >>$GITHUB_OUTPUT build: needs: package-name-prefix @@ -152,12 +152,11 @@ jobs: run: | TAG="${{ needs.package-name-prefix.outputs.prefix }}git-snapshot" declare -a artifacts=($(ls -d */)) - for artifact in ${artifacts[@]} - do + for artifact in ${artifacts[@]}; do cd $artifact checksum=$(sha256sum ${{ env.PROJECT_NAME }}_${TAG}*) cd .. - echo $checksum >> ${TAG}-checksums.txt + echo $checksum >>${TAG}-checksums.txt done - name: Upload checksum artifact diff --git a/.github/workflows/release-go-task.yml b/.github/workflows/release-go-task.yml index 99e9c2f12..76f35b4af 100644 --- a/.github/workflows/release-go-task.yml +++ b/.github/workflows/release-go-task.yml @@ -100,9 +100,9 @@ jobs: - name: Set environment variables run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV" + echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >>"$GITHUB_ENV" TAG="${GITHUB_REF/refs\/tags\//}" - echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV + echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >>$GITHUB_ENV - name: Checkout repository uses: actions/checkout@v5 @@ -120,7 +120,7 @@ jobs: # Arbitrary password for a keychain that exists only for the duration of the job, so not secret KEYCHAIN_PASSWORD: keychainpassword run: | - echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" + echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode >"${{ env.INSTALLER_CERT_MAC_PATH }}" security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" security default-keychain -s "${{ env.KEYCHAIN }}" security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" @@ -145,7 +145,7 @@ jobs: - name: Write gon config to file # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) run: | - cat > "${{ env.GON_CONFIG_PATH }}" <"${{ env.GON_CONFIG_PATH }}" < ${TAG}-checksums.txt + sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >${TAG}-checksums.txt - name: Identify Prerelease # This is a workaround while waiting for create-release action @@ -224,7 +224,7 @@ jobs: )" != \ "" \ ]]; then - echo "IS_PRE=true" >> $GITHUB_OUTPUT + echo "IS_PRE=true" >>$GITHUB_OUTPUT fi - name: Create Github Release and upload artifacts diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index a0b8bf6b8..9ef785c62 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -35,7 +35,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT spellcheck: needs: run-determination diff --git a/.github/workflows/sync-labels-npm.yml b/.github/workflows/sync-labels-npm.yml index 171564b76..3e43ab9ef 100644 --- a/.github/workflows/sync-labels-npm.yml +++ b/.github/workflows/sync-labels-npm.yml @@ -103,7 +103,7 @@ jobs: - name: Set environment variables run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV" + echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >>"$GITHUB_ENV" - name: Determine whether to dry run id: dry-run @@ -119,7 +119,7 @@ jobs: run: | # Use of this flag in the github-label-sync command will cause it to only check the validity of the # configuration. - echo "flag=--dry-run" >> $GITHUB_OUTPUT + echo "flag=--dry-run" >>$GITHUB_OUTPUT - name: Checkout repository uses: actions/checkout@v5 @@ -145,7 +145,7 @@ jobs: run: | # Merge all configuration files shopt -s extglob - cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}" + cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) >"${{ env.MERGED_CONFIGURATION_PATH }}" - name: Install github-label-sync run: npm install diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index 7a7ffbfe8..8698eb0a0 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -53,7 +53,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT test: needs: run-determination diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index c78440763..97985b365 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -55,7 +55,7 @@ jobs: RESULT="false" fi - echo "result=$RESULT" >> $GITHUB_OUTPUT + echo "result=$RESULT" >>$GITHUB_OUTPUT test: name: test (${{ matrix.module.path }} - ${{ matrix.operating-system }}) diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 0cca8197a..1602d2265 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -65,7 +65,7 @@ jobs: shell: bash run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable - echo "BINDIR=${{ runner.temp }}/custom-installation-folder" >> "$GITHUB_ENV" + echo "BINDIR=${{ runner.temp }}/custom-installation-folder" >>"$GITHUB_ENV" - name: Checkout repository uses: actions/checkout@v5