-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dwi Siswanto <[email protected]>
- Loading branch information
1 parent
3a1c956
commit a2e364a
Showing
1 changed file
with
15 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,32 +4,35 @@ on: | |
- cron: "0 0 * * 0" # at 00:00 on Sunday | ||
workflow_dispatch: | ||
|
||
env: | ||
DB_PATH: db/tlds.txt | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Install dependencies" | ||
run: sudo apt install curl -y | ||
|
||
- name: "Check out code" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Check for updates" | ||
run: | | ||
if [[ "$(curl -skL ${{ secrets.LOCAL_DB }} | wc -l)" == "$(curl -skL ${{ secrets.REMOTE_DB }} | wc -l)" ]]; then | ||
echo "::set-output name=isUpdated::true" | ||
local_ver="$(grep -oP '^# Version \K\d+' ${{ env.DB_PATH }})" | ||
remote_ver="$(curl -sr 0-20 ${{ secrets.REMOTE_DB }} | grep -oP '^# Version \K\d+')" | ||
if [[ "${local_ver}" -lt "${remote_ver}" ]]; then | ||
echo "isUpdated=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "::set-output name=isUpdated::false" | ||
echo "isUpdated=false" >> $GITHUB_OUTPUT | ||
fi | ||
echo "::set-output name=date::$(date)" | ||
- name: "Check out code" | ||
if: steps.check.isUpdated == 'false' | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
echo "date=$(date)" >> $GITHUB_OUTPUT | ||
- name: "Update DB..." | ||
if: steps.check.isUpdated == 'false' | ||
run: curl -kLo db/tlds.txt ${{ secrets.REMOTE_DB }} | ||
run: curl -kLo ${{ env.DB_PATH }} ${{ secrets.REMOTE_DB }} | ||
|
||
- name: Create Pull Request | ||
if: steps.check.isUpdated == 'false' | ||
|
@@ -39,7 +42,7 @@ jobs: | |
branch-suffix: "short-commit-hash" | ||
branch: "update/db" | ||
commit-message: "db: Update DB ${{ steps.check.date }}" | ||
committer: "Dwi Siswanto <[email protected]>" | ||
committer: "ghost <[email protected]>" | ||
delete-branch: true | ||
reviewers: "dwisiswant0" | ||
title: "db: Update DB ${{ steps.check.date }}" |