Audit Wiki Links #403
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: Audit Wiki Links | |
on: | |
schedule: | |
- cron: '0 0 * * * ' # At the end of everyday | |
workflow_dispatch: # Or manually from GitHub UI | |
jobs: | |
Audit_Links: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Set credentials | |
run: | | |
git config --global user.email "polkadot-kusama-automation-bot@users.noreply.github.com" | |
git config --global user.name "Polkadot-Kusama Bot" | |
- name: Check for existing branch | |
run: | | |
if [[ $(git ls-remote --heads origin refs/heads/audit-links | wc -l) == "1" ]]; then | |
echo deleting existing branch | |
git push origin --delete audit-links | |
else | |
echo no existing branch found | |
fi | |
- name: Create new branch | |
run: | | |
git branch audit-links | |
git checkout audit-links | |
- name: Execute python | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
python './scripts/auditLinks.py' | |
- name: Check results for broken links | |
run: | | |
File="./Audit-Results.md" | |
echo Reading Audit... | |
if test -f "$File"; then | |
TEXT=$(cat ./Audit-Results.md) | |
echo "audit_result=true" >> $GITHUB_ENV | |
else | |
echo "$File does not exist" | |
echo "audit_result=false" >> $GITHUB_ENV | |
fi | |
- name: Create GitHub Issue | |
if: ${{ env.audit_result == 'true' }} | |
uses: "JasonEtco/create-an-issue@v2" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
filename: ./Audit-Results.md |