SecLists/.github/workflows/readme-updater.yml
Ignacio J. Perez Portal 09d1e4cf21 fix(CICD): Added write permissions to the readme auto-updater workflow
Prevents the error 'remote: Permission to USERNAME/SecLists.git denied to github-actions[bot].' when the action is run automatically from a seclists fork that has the default github-actions security settings
2024-04-24 23:29:14 -03:00

39 lines
1.1 KiB
YAML

# If you change the commit message you need to change .bin/get-and-patch-readme-repository-details.py
name: Readme updater - Updates readme with latest stats
on:
push:
workflow_dispatch:
jobs:
update-readme:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Update readme
run: .bin/get-and-patch-readme-repository-details.py
- name: Commit files if changed
run: |
git add -N .
if [ -z "$(git ls-files --modified)" ]; then
echo "[+] No files were changed"
else
echo "[+] Files were changed! Pushing changed..."
git add -A
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git config --local user.email "example@github.com"
git config --local user.name "GitHub Action"
git commit -m "[Github Action] Automated readme update."
git push
fi