Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/update-geolite-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ jobs:
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git config --global user.name '${{ github.actor }}'

- name: Close obsolete GeoLite update PRs
run: |
set -euo pipefail
gh pr list \
--state open \
--base 'release-ulmo' \
--limit 100 \
--json number,title,headRefName \
--jq '.[] | select(.title == "Update GeoLite Database" and (.headRefName | contains("/geoip2-bot-update-country-database-"))) | .number' | \
xargs -r -I{} gh pr close {} \
--comment 'Superseded by a newer automated GeoLite database update. Please review the latest PR.'
env:
GH_TOKEN: ${{ secrets.GH_PAT_WITH_ORG }}

- name: Create a branch, commit the code and make a PR
id: create-pr
run: |
Expand All @@ -75,9 +89,20 @@ jobs:
git status
git commit -m "chore: geoip2: update maxmind geolite country database"
git push --set-upstream origin $BRANCH
cat > /tmp/pr_body.md <<'EOF'
PR generated by workflow `${{ github.workflow }}` on behalf of @${{ github.actor }}.

## Runbook
See: https://2u-internal.atlassian.net/wiki/spaces/AT/pages/3420061706/Runbook+GeoLite2+Country+Database+Update

## Actions Required
- [ ] Verify that only `common/static/data/geoip/GeoLite2-Country.mmdb` changed
- [ ] Wait for CI to pass
- [ ] Merge this PR
EOF
PR_URL=$(gh pr create \
--title "Update GeoLite Database" \
--body "PR generated by workflow `${{ github.workflow }}` on behalf of @${{ github.actor }}." \
--body-file /tmp/pr_body.md \
--head $BRANCH \
--base 'release-ulmo' \
--reviewer 'edx/orbi-bom' \
Expand Down
Loading