Website Status Check #3640
This file contains hidden or 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
| name: Website Status Check | |
| on: | |
| push: | |
| branches: [ main ] | |
| schedule: | |
| - cron: "0 * * * *" # 每小时运行一次 | |
| jobs: | |
| check-website-status: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Website status check | |
| id: check | |
| run: | | |
| # Using curl to check the status of the website | |
| status_code=$(curl -sL --write-out %{http_code} --silent --output /dev/null http://www.nrpstransformer.cn) | |
| echo "Status code: $status_code" | |
| # If status code is not 200, exit with an error | |
| if [ "$status_code" != "200" ]; then | |
| echo "Status code is not 200, website may be down." | |
| exit 1 | |
| fi |