style: fix inconsistent code style for shell scripts

This commit is contained in:
XuehaiPan
2021-09-15 14:59:01 +08:00
parent 9c03493774
commit 3f96d963f7
43 changed files with 421 additions and 331 deletions
+10 -10
View File
@@ -34,11 +34,11 @@ jobs:
- name: Deploy the tagged Docker image to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
run: |
brew_version=${GITHUB_REF:10}
echo "brew_version=$brew_version" >> ${GITHUB_ENV}
brew_version="${GITHUB_REF:10}"
echo "brew_version=${brew_version}" >> "${GITHUB_ENV}"
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version"
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version"
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}"
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}"
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
@@ -46,19 +46,19 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: |
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin
docker tag brew "homebrew/ubuntu${{matrix.version}}:$brew_version"
docker push "homebrew/ubuntu${{matrix.version}}:$brew_version"
docker tag brew "homebrew/ubuntu${{matrix.version}}:${brew_version}"
docker push "homebrew/ubuntu${{matrix.version}}:${brew_version}"
docker tag brew "homebrew/ubuntu${{matrix.version}}:latest"
docker push "homebrew/ubuntu${{matrix.version}}:latest"
- name: Deploy the homebrew/brew Docker image to GitHub Packages and Docker Hub
if: startsWith(github.ref, 'refs/tags/') && matrix.version == '20.04'
run: |
docker tag brew "ghcr.io/homebrew/brew:$brew_version"
docker push "ghcr.io/homebrew/brew:$brew_version"
docker tag brew "ghcr.io/homebrew/brew:${brew_version}"
docker push "ghcr.io/homebrew/brew:${brew_version}"
docker tag brew "ghcr.io/homebrew/brew:latest"
docker push "ghcr.io/homebrew/brew:latest"
docker tag brew "homebrew/brew:$brew_version"
docker push "homebrew/brew:$brew_version"
docker tag brew "homebrew/brew:${brew_version}"
docker push "homebrew/brew:${brew_version}"
docker tag brew "homebrew/brew:latest"
docker push "homebrew/brew:latest"
+10 -7
View File
@@ -40,20 +40,23 @@ jobs:
BRANCH="sorbet-files-update"
echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "$BRANCH"; then
git checkout "$BRANCH"
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git reset --hard origin/master
else
git checkout --no-track -B "$BRANCH" origin/master
git checkout --no-track -B "${BRANCH}" origin/master
fi
if brew typecheck --update --fail-if-not-changed; then
git add "$GITHUB_WORKSPACE/Library/Homebrew/sorbet"
if brew typecheck --update --fail-if-not-changed
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git commit -m "sorbet: Update RBI files." \
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
echo "::set-output name=committed::true"
PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
then
echo "::set-output name=pull_request::true"
fi
fi
+10 -7
View File
@@ -37,19 +37,22 @@ jobs:
BRANCH="spdx-update"
echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "$BRANCH"; then
git checkout "$BRANCH"
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git reset --hard origin/master
else
git checkout --no-track -B "$BRANCH" origin/master
git checkout --no-track -B "${BRANCH}" origin/master
fi
if brew update-license-data --fail-if-not-changed; then
git add "$GITHUB_WORKSPACE/Library/Homebrew/data/spdx"
if brew update-license-data --fail-if-not-changed
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
echo "::set-output name=committed::true"
PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
then
echo "::set-output name=pull_request::true"
fi
fi
+11 -10
View File
@@ -90,10 +90,10 @@ jobs:
- name: Set up all Homebrew taps
run: |
HOMEBREW_REPOSITORY="$(brew --repo)"
HOMEBREW_CORE_REPOSITORY="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core"
git -C "$HOMEBREW_CORE_REPOSITORY" remote add homebrew_core https://github.com/Homebrew/homebrew-core
git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core || git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core
git -C "$HOMEBREW_CORE_REPOSITORY" checkout --force -B master homebrew_core/master
HOMEBREW_CORE_REPOSITORY="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core"
git -C "${HOMEBREW_CORE_REPOSITORY}" remote add homebrew_core https://github.com/Homebrew/homebrew-core
git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core || git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core
git -C "${HOMEBREW_CORE_REPOSITORY}" checkout --force -B master homebrew_core/master
brew tap homebrew/aliases
brew tap homebrew/autoupdate
@@ -111,7 +111,7 @@ jobs:
brew update-reset Library/Taps/homebrew/homebrew-bundle
# brew style doesn't like world writable directories
sudo chmod -R g-w,o-w "$HOMEBREW_REPOSITORY/Library/Taps"
sudo chmod -R g-w,o-w "${HOMEBREW_REPOSITORY}/Library/Taps"
- name: Run brew style on homebrew-core
run: brew style --display-cop-names homebrew/core
@@ -178,11 +178,11 @@ jobs:
- name: Deploy the Docker image to GitHub Packages and Docker Hub
if: github.ref == 'refs/heads/master'
run: |
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | \
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} |
docker login ghcr.io -u BrewTestBot --password-stdin
docker tag brew "ghcr.io/homebrew/ubuntu16.04:master"
docker push "ghcr.io/homebrew/ubuntu16.04:master"
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | \
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} |
docker login -u brewtestbot --password-stdin
docker tag brew "homebrew/ubuntu16.04:master"
docker push "homebrew/ubuntu16.04:master"
@@ -321,9 +321,10 @@ jobs:
run: |
# Retry multiple times when using BuildPulse to detect and submit
# flakiness (because rspec-retry is disabled).
if [ -n "$HOMEBREW_BUILDPULSE_ACCESS_KEY_ID" ]; then
brew tests --online --coverage || \
brew tests --online --coverage || \
if [[ -n "${HOMEBREW_BUILDPULSE_ACCESS_KEY_ID}" ]]
then
brew tests --online --coverage ||
brew tests --online --coverage ||
brew tests --online --coverage
else
brew tests --online --coverage
+15 -11
View File
@@ -44,27 +44,31 @@ jobs:
BRANCH=update-man-completions
echo "::set-output name=branch::${BRANCH}"
if git ls-remote --exit-code --heads origin "$BRANCH"; then
git checkout "$BRANCH"
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git reset --hard origin/master
else
git checkout --no-track -B "$BRANCH" origin/master
git checkout --no-track -B "${BRANCH}" origin/master
fi
if [ "${{github.event_name}}" != "push" ]; then
if [[ "${{github.event_name}}" != "push" ]]
then
brew update-maintainers
fi
if brew generate-man-completions --fail-if-not-changed; then
git add "$GITHUB_WORKSPACE/README.md" \
"$GITHUB_WORKSPACE/docs/Manpage.md" \
"$GITHUB_WORKSPACE/manpages/brew.1" \
"$GITHUB_WORKSPACE/completions"
if brew generate-man-completions --fail-if-not-changed
then
git add "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions"
git commit -m "Update maintainers, manpage and completions." \
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow."
echo "::set-output name=committed::true"
PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
then
echo "::set-output name=pull_request::true"
fi
fi
+6 -3
View File
@@ -51,7 +51,8 @@ jobs:
run: |
set -u
if [[ "${GEM_NAME}" == 'sorbet' ]]; then
if [[ "${GEM_NAME}" == 'sorbet' ]]
then
brew vendor-gems --update sorbet,sorbet-runtime
else
brew vendor-gems
@@ -63,8 +64,10 @@ jobs:
run: |
set -u
if brew typecheck --update --fail-if-not-changed; then
if git add Library/Homebrew/sorbet; then
if brew typecheck --update --fail-if-not-changed
then
if git add Library/Homebrew/sorbet
then
git commit -m "Update RBI files for ${GEM_NAME}."
fi