Skip to content

Commit aa4b195

Browse files
committed
test
1 parent be0ce5a commit aa4b195

File tree

2 files changed

+7
-38
lines changed

2 files changed

+7
-38
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ jobs:
1313
compile:
1414
name: Compiles
1515
runs-on: ubuntu-latest
16-
defaults:
17-
run:
18-
shell: bash -e {0} 1>> ${{ github.workspace }}/stdout.log 2>> ${{ github.workspace }}/stderr.log
1916
steps:
2017
- uses: actions/checkout@v4
2118
with:
@@ -56,22 +53,18 @@ jobs:
5653
- name: post build errors as PR comment
5754
if: failure()
5855
run: |
59-
# gh run view ${{ github.run_id }} --repo ${{ github.repository }} --log-failed > logs.txt
60-
# ERRORS=$(cat logs.txt |
61-
# cut -d$'\t' -f3 | # remove workflow/step columns
62-
# cut -d' ' -f2-) # remove timestamp
63-
# sed -n '/\[.*error.*\]/I,$p') # select lines from '[...error...]' or 'npm err' (case-insensitive) to EOF
56+
gh run view ${{ github.run_id }} --repo ${{ github.repository }} --log-failed > logs.txt
6457
65-
echo $SHELLOPTS
58+
ERRORS=$(cat logs.txt |
59+
cut -d$'\t' -f3 | # remove workflow/step columns
60+
cut -d' ' -f2-) # remove timestamp
61+
sed -n '/\[.*error.*\]/I,$p') # select lines from '[...error...]' or 'npm err' (case-insensitive) to EOF
6662
67-
ls ${{ github.workspace }}
68-
cat ${{ github.workspace }}/stderr.log
69-
70-
if [ -s "stderr.log" ]; then
63+
if [ -n $ERRORS ]; then
7164
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
7265
7366
URL=$(gh run view ${{ github.run_id }} --json url --jq '.url')
74-
BODY="[Build failed]($URL)\n\n\`\`\`txt\n$(cat stderr.log)\n\`\`\`"
67+
BODY="[Build failed]($URL)\n\n\`\`\`txt\n$ERRORS\n\`\`\`"
7568
7669
gh pr comment ${{ github.event.number }} --repo ${{ github.repository }} --body $BODY
7770
fi

foo.log

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)