fetch georelays working workflow

This commit is contained in:
a1denvalu3
2026-01-13 00:27:10 +01:00
parent b84c36c6fa
commit 6defae71c6
+13 -42
View File
@@ -25,47 +25,18 @@ jobs:
wget -q https://raw.githubusercontent.com/permissionlesstech/georelays/refs/heads/main/nostr_relays.csv wget -q https://raw.githubusercontent.com/permissionlesstech/georelays/refs/heads/main/nostr_relays.csv
mv nostr_relays.csv ./relays/online_relays_gps.csv mv nostr_relays.csv ./relays/online_relays_gps.csv
- name: Configure git - name: Check for changes
id: git-check
run: | run: |
git config user.email "action@github.com" git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
git config user.name "GitHub Action"
- name: Commit and push changes
- name: Create update branch if changes if: steps.git-check.outputs.changes == 'true'
id: create_branch
run: | run: |
# exit early if no changes git config --local user.email "action@github.com"
if git diff --quiet --relays/online_relays_gps.csv; then git config --local user.name "GitHub Action"
echo "changed=false" >> $GITHUB_OUTPUT git add app/src/main/assets/nostr_relays.csv
exit 0 git commit -m "Automated update of relay data - $(date -u)"
fi git push
env:
# branch name with timestamp GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH="update-georelays-$(date -u +%Y%m%dT%H%M%SZ)"
git checkout -b "$BRANCH"
git add relays/online_relays_gps.csv
git commit -m "Automated update of relay data - $(date -u --rfc-3339=seconds)"
echo "changed=true" >> $GITHUB_OUTPUT
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Push branch
if: steps.create_branch.outputs.changed == 'true'
run: |
git push --set-upstream origin "${{ steps.create_branch.outputs.branch }}"
- name: Create pull request
if: steps.create_branch.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Automated update of relay data
branch: ${{ steps.create_branch.outputs.branch }}
base: main
title: Automated update of relay data
body: |
This PR was created automatically by the scheduled workflow. It updates relays/online_relays_gps.csv from the GeoRelays source.
labels: automated, georelays
- name: No changes
if: steps.create_branch.outputs.changed != 'true'
run: echo "No changes to relays/online_relays_gps.csv"