Test website safety #235
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
name: Test website safety | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 * * *' # Runs every day at 2am | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check website safety | |
run: | | |
curl -d 'hidden=true' 'https://observatory-api.mdn.mozilla.net/api/v2/scan?host=michaeltroger.com' > temp_testreport.txt | |
rm testreport.txt | |
echo "Test report generated via observatory.mozilla.org API" >> testreport.txt | |
cat temp_testreport.txt | grep -oP '(?<="grade":")[^"]*' | sed 's/^/Grade: /' >> testreport.txt | |
cat temp_testreport.txt | grep -oP '(?<="score":)\d+' | sed 's/^/Score: /' >> testreport.txt | |
cat temp_testreport.txt | grep -oP '(?<="tests_quantity":)\d+' | sed 's/^/Total Tests: /' >> testreport.txt | |
cat temp_testreport.txt | grep -oP '(?<="tests_failed":)\d+' | sed 's/^/Failed Tests: /' >> testreport.txt | |
rm temp_testreport.txt | |
- name: Create pull request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
branch: feature/update_testreport | |
title: Update of test report | |
commit-message: Update of test report | |
add-paths: | | |
testreport.txt |