Skip to content

Commit

Permalink
Format scripts using shfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Apr 18, 2024
1 parent 65c6f82 commit 23c6194
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let

programs.rustfmt.enable = true;
programs.nixfmt-rfc-style.enable = true;
programs.shfmt.enable = true;
};

results = {
Expand Down
6 changes: 3 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "Building release artifact for system $system"

nix-build "$root" -A build -o "$tmp/build" >/dev/null
readarray -t closure < <(nix-store -qR "$tmp/build")
nix-store --export "${closure[@]}" > "$tmp/$system.nar"
nix-store --export "${closure[@]}" >"$tmp/$system.nar"
gzip "$tmp/$system.nar"
artifactName=$system.nar.gz

Expand All @@ -61,7 +61,7 @@ if ! release=$(gh api \
echo "Failed to create release: $release"
fi

releaseId=$(jq .id <<< "$release")
releaseId=$(jq .id <<<"$release")

abortRelease() {
echo "Aborting, deleting the draft release"
Expand Down Expand Up @@ -100,4 +100,4 @@ if ! publishResult=$(gh api \
abortRelease
fi

echo "Published release: $(jq .html_url -r <<< "$publishResult")"
echo "Published release: $(jq .html_url -r <<<"$publishResult")"
16 changes: 8 additions & 8 deletions scripts/update-github-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trap 'rm -rf "$tmp"' exit

# Use dependency groups to update all dependencies together
# Note that repo is not used because we pass `--local` on the CLI
cat <<EOF > "$tmp/input.yml"
cat <<EOF >"$tmp/input.yml"
job:
package-manager: "github_actions"
allowed-updates:
Expand All @@ -39,16 +39,16 @@ job:
EOF

if create_pull_request=$(LOCAL_GITHUB_ACCESS_TOKEN="$githubToken" \
dependabot update --file "$tmp/input.yml" --local "$REPO_ROOT" \
| jq --exit-status 'select(.type == "create_pull_request").data'); then
dependabot update --file "$tmp/input.yml" --local "$REPO_ROOT" |
jq --exit-status 'select(.type == "create_pull_request").data'); then

jq --exit-status --raw-output '."pr-body"' <<< "$create_pull_request"
jq --exit-status --raw-output '."pr-body"' <<<"$create_pull_request"

jq --compact-output '."updated-dependency-files"[]' <<< "$create_pull_request" \
| while read -r fileUpdate; do
file=$(jq --exit-status --raw-output '.name' <<< "$fileUpdate")
jq --compact-output '."updated-dependency-files"[]' <<<"$create_pull_request" |
while read -r fileUpdate; do
file=$(jq --exit-status --raw-output '.name' <<<"$fileUpdate")
# --join-output makes sure to not output a trailing newline
jq --exit-status --raw-output --join-output '.content' <<< "$fileUpdate" > "$REPO_ROOT/$file"
jq --exit-status --raw-output --join-output '.content' <<<"$fileUpdate" >"$REPO_ROOT/$file"
done
fi

Expand Down

0 comments on commit 23c6194

Please sign in to comment.