Skip to content

Commit

Permalink
Rename actions, add nicer output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMoll committed Mar 8, 2024
1 parent 4f638ba commit c5213d9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/webcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ env:
# TODO: would be good to catch various failures and present a more friendly message.

jobs:
myjob:
webcheck:
runs-on: ubuntu-latest
steps:
- name: Fetch website
id: curl
# If this step fails, likely some issue with DNS, HTTPS, or server not running.
run: curl $WEBSITE_URL -o index.html --connect-timeout 5
run: curl $WEBSITE_URL -o index.html --connect-timeout 5 -sS 2>&1 | sed -e 's/^/OUTPUT=/;' >> $GITHUB_OUTPUT

- name: Error message if cURL fails
if: failure()
# Hopefully displays a nicely formatted error
run: echo "::error title=cURL:: ${{ steps.curl.outputs.OUTPUT }}"

- uses: actions/checkout@v4
with:
Expand All @@ -36,5 +42,11 @@ jobs:
id: git_sha

- name: Search for Git SHA in fetched HTML
id: grep
# If this step fails, then the website is out-of-date.
run: grep ${{steps.git_sha.outputs.SHA}} index.html

- name: Error message if SHA mismatches
# Only run if this specific step failed.
if: failure() && steps.grep.conclusion == 'failure'
run: echo ::error title=SHA mismatch:: The commit SHA ${{steps.git_sha.outputs.SHA}} was not found in index.html!

0 comments on commit c5213d9

Please sign in to comment.