Skip to content

Commit 7944f38

Browse files
committed
💚 Use pipe rather than command substitution
Signed-off-by: kei-g <km.8k6ce+github@gmail.com>
1 parent 683e24d commit 7944f38

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,25 @@ jobs:
2121
- name: Build
2222
run: |
2323
npm run build
24-
- name: Commit and push if necessary
24+
- env:
25+
GH_TOKEN: ${{ github.token }}
26+
name: Commit and push if necessary
2527
run: |
2628
git add -N .
27-
while read -d $'\0' -r name; do
29+
git diff --name-only -z | while read -d $'\0' -r name; do
2830
escaped=${name//%/%25}
2931
escaped=${escaped//$'\r'/%0D}
3032
escaped=${escaped//$'\n'/%0A}
3133
echo "::group::Put $escaped"
3234
gh api \
33-
--field branch=main \
34-
--field content=@<(base64 -i "$name") \
35-
--field message=":package: Build $name" \
36-
--field sha=$(git rev-parse "main:$name") \
37-
--method PUT \
38-
/repos/{owner}/{repo}/contents/"$name"
35+
--field branch=main \
36+
--field content=@"$name" \
37+
--field message=":package: Build $name" \
38+
--field sha=$(git rev-parse "main:$name") \
39+
--method PUT \
40+
"/repos/{owner}/{repo}/contents/$name"
3941
echo ::endgroup ::
40-
done < <(git diff --name-only -z)
42+
done
4143
shell: bash
4244
name: Build
4345
on:

0 commit comments

Comments
 (0)