Skip to content
50 changes: 50 additions & 0 deletions .github/workflows/update-servers-list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Update servers list
on:
workflow_dispatch:
schedule:
- cron: "11 3 1 */2 *" # Run at 03:11 on the 1st of every 2nd month
jobs:
update-servers-list:
if: github.repository == 'qdm12/gluetun'
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod

- name: Update servers list
run: |
go run ./cmd/gluetun/main.go update -all -maintainer -minratio 0.2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add -proton-email and -proton-password. See

verify-private:
on how to use secrets, I'll set secrets.PROTON_EMAIL and secrets.PROTON_PASSWORD for it.

- name: Check for changes
run: |
git diff --exit-code internal/storage/servers.json >/dev/null
- name: Check no other file changes
run: |
! git diff --exit-code ':!internal/storage/servers.json' >/dev/null
- name: Validate json
run: |
cat internal/storage/servers.json | jq -e >/dev/null
- name: Create Pull Request
id: createpr
uses: peter-evans/create-pull-request@v7
with:
branch: bot/update-servers-list
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we name that branch with the current date YYYY-MM-DD so it doesn't conflict if one doesn't get merged or isn't deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that would be overkill if it runs every two months but then I added functionality to allow manually triggering the workflow so it makes a lot of sense now.

base: master
delete-branch: true

- name: Merge Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr merge ${{ steps.createpr.outputs.pull-request-number }} --auto -m -d
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this commented for now? So we can merge manually a few times, then fully automate