-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provides a GitHub actions that runs regularly, checking the website is a) online and b) up-to-date. If the job fails, it indicates that something is amiss with the infrastructure (Runciman, at time of writing).
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Website alive and correct | ||
|
||
on: | ||
schedule: | ||
- cron: 30 8 * * 1-5 | ||
# 8:30am, Mon-Fri | ||
workflow_dispatch: | ||
# Also work manually with a button press in GitHub UI. | ||
|
||
env: | ||
WEBSITE_URL: "https://www.hacksoc.org/" | ||
|
||
# TODO: would be good to catch various failures and present a more friendly message. | ||
|
||
jobs: | ||
myjob: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch website | ||
# If this step fails, likely some issue with DNS, HTTPS, or server not running. | ||
run: curl $WEBSITE_URL -o index.html --connect-timeout 5 | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
# Only need the latest commit | ||
fetch-depth: 1 | ||
# And don't even need any files! | ||
sparse-checkout: . | ||
|
||
- name: Get Git SHA of HEAD | ||
run: git rev-parse main | sed -e 's/^/SHA=/;' >> $GITHUB_OUTPUT | ||
# git rev-parse main -- gets the full SHA1 of the most recent commit to 'main' branch | ||
# sed -e 's/^/SHA=/;' -- adds "sha=" to the start of the line. This is important because... | ||
# >> $GITHUB_OUTPUT -- Store the output in a variable so we can use it later. | ||
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter | ||
id: git_sha | ||
|
||
- name: Search for Git SHA in fetched HTML | ||
# If this step fails, then the website is out-of-date. | ||
run: grep ${{steps.git_sha.outputs.SHA}} index.html |