Skip to content

Commit 45e7338

Browse files
committed
Upload results as an artifact
1 parent 93a66b2 commit 45e7338

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

.github/workflows/markdown_links.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ jobs:
4040
# Define the type of virtual host machine:
4141
runs-on: ubuntu-latest
4242

43+
# Define environment variables:
44+
env:
45+
LOG_DIR: "${{ github.workspace }}/tmp/var/log"
46+
LOG_FILE_FAILURES: "${{ github.workspace }}/tmp/var/log/failures.json"
47+
LOG_FILE_WARNINGS: "${{ github.workspace }}/tmp/var/log/warnings.json"
48+
49+
# Set defaults:
50+
defaults:
51+
run:
52+
# Set the default shell to `bash`:
53+
shell: bash --noprofile --norc -eo pipefail {0}
54+
4355
# Define the sequence of job steps...
4456
steps:
4557

@@ -57,6 +69,14 @@ jobs:
5769
lfs: false
5870
timeout-minutes: 10
5971

72+
# Initialize log files:
73+
- name: 'Initialize log files'
74+
run: |
75+
mkdir -p "${{ env.LOG_DIR }}"
76+
touch "${{ env.LOG_FILE_FAILURES }}"
77+
touch "${{ env.LOG_FILE_WARNINGS }}"
78+
timeout-minutes: 2
79+
6080
# Check for broken links:
6181
- name: 'Check links'
6282
uses: stdlib-js/broken-markdown-url-definitions-action@main
@@ -68,11 +88,8 @@ jobs:
6888
# Log the results:
6989
- name: 'Log results'
7090
run: |
71-
echo "Failures: "
72-
echo ${{ steps.results.outputs.failures }}
73-
echo "Warnings: "
74-
echo ${{ steps.results.outputs.warnings }}
75-
echo Status: ${{ steps.results.outputs.status }}
91+
echo "${{ steps.results.outputs.failures }}" >> "${{ env.LOG_FILE_FAILURES }}"
92+
echo "${{ steps.results.outputs.warnings }}" >> "${{ env.LOG_FILE_WARNINGS }}"
7693
timeout-minutes: 2
7794

7895
# Fail the workflow if the status is not "success":
@@ -81,6 +98,31 @@ jobs:
8198
run: |
8299
exit 1
83100
101+
# View the log file if the previous step fails:
102+
- name: 'View log file'
103+
if: failure()
104+
run: |
105+
echo "Printing the list of failures..."
106+
cat "${{ env.LOG_FILE_FAILURES }}"
107+
timeout-minutes: 5
108+
109+
# Upload the log files:
110+
- name: 'Upload log files'
111+
uses: actions/upload-artifact@v2
112+
if: always()
113+
with:
114+
# Define a name for the uploaded artifact:
115+
name: results
116+
117+
# Specify the paths to upload:
118+
path: |
119+
${{ env.LOG_FILE_FAILURES }}
120+
${{ env.LOG_FILE_WARNINGS }}
121+
122+
# Specify the number of days to retain the artifact (default is 90 days):
123+
retention-days: 10
124+
timeout-minutes: 10
125+
84126
# Define a job for sending notifications to Slack...
85127
slack:
86128

0 commit comments

Comments
 (0)