Create report #183
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: Create report | |
on: | |
schedule: | |
- cron: '0 4 * * *' | |
workflow_dispatch: | |
jobs: | |
create-report: | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.set-output.outputs.status }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Python 3.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install requests python-whois dnspython beautifulsoup4 selenium | |
# - name: Setup Chrome | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y unzip xvfb libxi6 libgconf-2-4 | |
# sudo apt-get install -y google-chrome-stable | |
# | |
# - name: Install Chromedriver | |
# run: | | |
# CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'` | |
# DRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"` | |
# curl -s -O "https://chromedriver.storage.googleapis.com/${DRIVER_VERSION}/chromedriver_linux64.zip" | |
# unzip chromedriver_linux64.zip -d ~/ | |
# rm -f chromedriver_linux64.zip | |
# sudo mv -f ~/chromedriver /usr/local/bin/chromedriver | |
# sudo chown root:root /usr/local/bin/chromedriver | |
# sudo chmod 0755 /usr/local/bin/chromedriver | |
- name: Run Website Tests | |
id: test | |
run: python main.py || echo "error" >> error.log | |
continue-on-error: true # This will ensure the next steps are executed even if this step fails. | |
- name: Set Output status | |
id: set-output | |
run: | | |
if [[ -f error.log ]]; then | |
echo "Error encountered in Website Tests" | |
echo "::set-output name=status::error" | |
else | |
echo "::set-output name=status::success" | |
fi | |
- name: Commit and push report | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m "Add generated report" -a || echo "No changes to commit" | |
git push | |
- name: Fail if error encountered | |
if: steps.set-output.outputs.status == 'error' | |
run: exit 1 |