Skip to content

Commit 1858ee9

Browse files
authored
test for GITHUB_OUTPUT (#973)
* test for GITHUB_OUTPUT When running locally, the environment variables set by GH actions aren't set. Check for their existence before writing to them. * Add checks around all GITUB_OUTPUT Check for the existence of the environment so our scripts don't fail when run locally. * remove testing code. * simplify * fix syntax error * respond to feedback Because we're using `set -e`, we don't need to check the most recent error code before determining that it completed successfully. * remove duplicate line
1 parent 5d2f0a8 commit 1858ee9

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

tools/run-converter.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ dotnet run --project $CONVERTER_PROJECT -- \
2121
$SPEC_DIRECTORY/*.md $TEMPLATE \
2222
-o $OUTPUT_DIRECTORY/standard.docx
2323

24-
if [ "$?" -eq "0" ]
24+
if [ -n "$GITHUB_OUTPUT" ]
2525
then
26-
# Success: Write key/value for GitHub action to read:
2726
echo "status=success" >> $GITHUB_OUTPUT
28-
else
29-
# Failed: report the error to the GitHub action:
30-
echo "status=failed" >> $GITHUB_OUTPUT
3127
fi

tools/run-section-renumber.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ fi
1111

1212
dotnet run --project $PROJECT -- $1
1313

14-
if [ "$?" -eq "0" ]
14+
if [ -n "$GITHUB_OUTPUT" ]
1515
then
16-
# Success: Write key/value for GitHub action to read:
1716
echo "status=success" >> $GITHUB_OUTPUT
18-
else
19-
# Failed: report the error to the GitHub action:
20-
echo "status=failed" >> $GITHUB_OUTPUT
2117
fi

tools/run-smarten.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ done
1717
rm -rf smarten
1818

1919
# I think always success, but echo the success output anyway:
20-
echo "status=success" >> $GITHUB_OUTPUT
20+
if [ -n "$GITHUB_OUTPUT" ]
21+
then
22+
echo "status=success" >> $GITHUB_OUTPUT
23+
fi

tools/update-grammar-annex.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,7 @@ echo Insert EOF Stuff
4949
cat $GRAMMAR_PROJECT/grammar-eof-insert.md >>$OUTPUT_FILE
5050

5151
# I think always success, but echo the success output anyway:
52-
echo "status=success" >> $GITHUB_OUTPUT
52+
if [ -n "$GITHUB_OUTPUT" ]
53+
then
54+
echo "status=success" >> $GITHUB_OUTPUT
55+
fi

0 commit comments

Comments
 (0)