From 70c0c33ba4568b9efc9279fe843b6f7820d28d50 Mon Sep 17 00:00:00 2001 From: Thomas Qvidahl Date: Fri, 24 Mar 2023 15:56:44 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=93=9D=20Update=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aea23fc..e06a285 100644 --- a/README.md +++ b/README.md @@ -15,17 +15,21 @@ You should probably avoid spamming the tu.no website, as they might react with b 1. Get your Slack Incoming Webhook URL set up. 2. Set up your kvdb.io bucket, ie like this `curl -d 'email=user@example.com' https://kvdb.io` 3. Install Golang. Or just run the bot in a Github workflow. See `.github/workflows` for examples. -4. Set environment variable as below, or in a `.env` file for automatic inclusion: +4. Set environment variables as below, or in a `.env` file for automatic inclusion for local development: -```bash -WEBHOOK_URL="https://hooks.slack.com/services/THIS/IS/PRIVATE" -KVDB_BUCKET="yourBucketId" -``` + ```bash + WEBHOOK_URL="https://hooks.slack.com/services/YOUR/PRIVATE/PARTS" + KVDB_BUCKET="yourBucketId" + ``` 5. Set a key in your KVDB bucket to the comic id of the XKCD comic you want to start tracking from. As of this writing the current comic is 2752. + ```bash curl https://kvdb.io/yourBucketId/xkcd -d '2752' ``` + + Attention!! If you set this number to anything below the latest comic, it will attempt to download every comic sequentially! + 6. Run the bot with `go run .` This should download the images of the current comics to `pwd`, and post their URLs to Slack. @@ -33,7 +37,7 @@ This should download the images of the current comics to `pwd`, and post their U ## Building and running with Docker 1. Build the image `docker build --tag comicbot .` -1. Run the container `docker run --env WEBHOOK_URL="" comicbot` +1. Run the container `docker run --env WEBHOOK_URL="" --env KVDB_BUCKET="" comicbot` ## Building and publishing to Dockerhub From 4e7302420507ba20f49cc1b4d6031056c07f2731 Mon Sep 17 00:00:00 2001 From: Thomas Qvidahl Date: Fri, 24 Mar 2023 15:59:17 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=92=9A=20Corrected=20go=20run=20comma?= =?UTF-8?q?nd.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on_demand.yml | 2 +- .github/workflows/on_schedule.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_demand.yml b/.github/workflows/on_demand.yml index c2e08d7..c5353e8 100644 --- a/.github/workflows/on_demand.yml +++ b/.github/workflows/on_demand.yml @@ -20,4 +20,4 @@ jobs: with: go-version: 1.20 - name: Run - run: go run comicbot.go functions.go + run: go run . diff --git a/.github/workflows/on_schedule.yml b/.github/workflows/on_schedule.yml index 27a0e66..3f2a8ec 100644 --- a/.github/workflows/on_schedule.yml +++ b/.github/workflows/on_schedule.yml @@ -18,4 +18,4 @@ jobs: with: go-version: 1.20 - name: Run - run: go run comicbot.go functions.go + run: go run . From 862d36ad863e589da590da1a9907e02284f63cd6 Mon Sep 17 00:00:00 2001 From: Thomas Qvidahl Date: Mon, 27 Mar 2023 07:52:31 +0200 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=92=9A=20Try=20changing=20the=20way?= =?UTF-8?q?=20comicbot=20is=20built=20and=20launched.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on_demand.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on_demand.yml b/.github/workflows/on_demand.yml index c5353e8..87e4e17 100644 --- a/.github/workflows/on_demand.yml +++ b/.github/workflows/on_demand.yml @@ -20,4 +20,4 @@ jobs: with: go-version: 1.20 - name: Run - run: go run . + run: go build && ./comicbot From 835da7aea8e4a129b22fdc21d9b1519216cbd47f Mon Sep 17 00:00:00 2001 From: Thomas Qvidahl Date: Mon, 27 Mar 2023 09:01:19 +0200 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=92=9A=20Change=20command=20to=20run?= =?UTF-8?q?=20bot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on_schedule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on_schedule.yml b/.github/workflows/on_schedule.yml index 558845f..2293b6b 100644 --- a/.github/workflows/on_schedule.yml +++ b/.github/workflows/on_schedule.yml @@ -20,4 +20,4 @@ jobs: with: go-version: 1.20 - name: Run - run: go build && ./comicbot + run: go run comicbot.go From 8b7cc1ba7d70c7f15f616af331144e2e768476c8 Mon Sep 17 00:00:00 2001 From: Thomas Qvidahl Date: Mon, 27 Mar 2023 09:04:24 +0200 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=92=9A=20Run=20in=20dev=20on=20all=20?= =?UTF-8?q?pushes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on_demand.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_demand.yml b/.github/workflows/on_demand.yml index c2e08d7..ed05534 100644 --- a/.github/workflows/on_demand.yml +++ b/.github/workflows/on_demand.yml @@ -3,7 +3,6 @@ name: "Comicbot test" on: workflow_dispatch: push: - branches: [ develop ] pull_request: branches: [ develop ] @@ -15,9 +14,11 @@ jobs: WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} steps: - uses: actions/checkout@v3 + with: + ref: '7338dba4484869cc029f4f03ca61b9982a770028' # Checkout previous version supporting Dunce - name: Set up Go uses: actions/setup-go@v3 with: go-version: 1.20 - name: Run - run: go run comicbot.go functions.go + run: go run comicbot.go From 501cb9f089c22e8f608017544ac4afcef494e2a2 Mon Sep 17 00:00:00 2001 From: Thomas Qvidahl Date: Mon, 27 Mar 2023 09:15:37 +0200 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=92=9A=20Use=20go-setupv4.=20Install?= =?UTF-8?q?=20dependencies=20separately.=20Run=20comicbot.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/on_demand.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_demand.yml b/.github/workflows/on_demand.yml index ed05534..0078c23 100644 --- a/.github/workflows/on_demand.yml +++ b/.github/workflows/on_demand.yml @@ -3,6 +3,7 @@ name: "Comicbot test" on: workflow_dispatch: push: + branches: [ develop ] pull_request: branches: [ develop ] @@ -17,8 +18,10 @@ jobs: with: ref: '7338dba4484869cc029f4f03ca61b9982a770028' # Checkout previous version supporting Dunce - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: 1.20 + - name: Install dependencies + run: go get . - name: Run run: go run comicbot.go