Generate alert docs for website #118
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: Generate alert docs for website | |
on: | |
workflow_dispatch: | |
schedule: # The start of every Friday | |
- cron: '0 0 * * 5' | |
jobs: | |
update-alerts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: zap-admin | |
- name: Checkout zaproxy-website | |
uses: actions/checkout@v3 | |
with: | |
repository: zaproxy/zaproxy-website | |
persist-credentials: false | |
path: zaproxy-website | |
fetch-depth: 0 | |
- name: Update alert docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.ZAPBOT_TOKEN }} | |
run: | | |
# Setup git details | |
export GITHUB_USER=zapbot | |
git config --global user.email "[email protected]" | |
git config --global user.name $GITHUB_USER | |
# Run the ZAP script | |
docker run -v $(pwd):/zap/wrk/:rw --user root -t ghcr.io/zaproxy/zaproxy:nightly ./zap.sh -addoninstallall -silent -script /zap/wrk/zap-admin/scripts/generate_alert_pages.js -cmd | |
cd zaproxy-website | |
git checkout -b update-alerts | |
# Update the index to be sure git is aware of changes | |
git update-index -q --refresh | |
git add site/content/docs/alerts/ site/data/alerttags.yml | |
## If there are changes: comment, commit, PR | |
if ! git diff-index --quiet HEAD --; then | |
git remote set-url origin https://$GITHUB_USER:[email protected]/$GITHUB_USER/zaproxy-website.git | |
git commit -m "Update alert pages" --signoff | |
git push --set-upstream origin update-alerts --force | |
hub pull-request -b zaproxy:main --no-edit | |
fi |