Update #23
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: Update | |
on: | |
schedule: | |
- cron: '12 6 5 * *' | |
- cron: '12 6 20 * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
name: Update prefixes | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19.x | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-1.19.x-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-1.19.x- | |
- run: go run code.dny.dev/ssrf/cmd/ssrfgen -output.gen=./ssrf_gen.go | |
- name: Commit, push and PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.SSRFGEN_UPDATE_TOKEN }} | |
run: | | |
if test -n "$(git status -s)"; then | |
git checkout -b update-$(date +"%Y-%m-%d") | |
git add . | |
git config user.name "ssrfgen-bot" | |
git config user.email "[email protected]" | |
git commit -m "Updated prefixes by ssrfgen" | |
git push -u origin HEAD | |
gh api repos/daenney/ssrf/pulls -f title='Updated prefixes by ssrfgen' -f base='main' -f head="update-$(date +'%Y-%m-%d')" -f body='' | |
else | |
echo "No changes to generated code" | |
fi |