|
40 | 40 | # Define the type of virtual host machine:
|
41 | 41 | runs-on: ubuntu-latest
|
42 | 42 |
|
| 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 | + |
43 | 55 | # Define the sequence of job steps...
|
44 | 56 | steps:
|
45 | 57 |
|
|
57 | 69 | lfs: false
|
58 | 70 | timeout-minutes: 10
|
59 | 71 |
|
| 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 | + |
60 | 80 | # Check for broken links:
|
61 | 81 | - name: 'Check links'
|
62 | 82 | uses: stdlib-js/broken-markdown-url-definitions-action@main
|
|
68 | 88 | # Log the results:
|
69 | 89 | - name: 'Log results'
|
70 | 90 | 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 }}" |
76 | 93 | timeout-minutes: 2
|
77 | 94 |
|
78 | 95 | # Fail the workflow if the status is not "success":
|
|
81 | 98 | run: |
|
82 | 99 | exit 1
|
83 | 100 |
|
| 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 | + |
84 | 126 | # Define a job for sending notifications to Slack...
|
85 | 127 | slack:
|
86 | 128 |
|
|
0 commit comments