Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions .github/workflows/on_demand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ 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
uses: actions/setup-go@v4
with:
go-version: 1.20
- name: Install 3rd party dependencies
run: go get
- name: Install dependencies
run: go get .
- name: Run
run: go run comicbot.go functions.go
run: go run comicbot.go
6 changes: 3 additions & 3 deletions .github/workflows/on_schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.20
- name: Install 3rd party dependencies
run: go get
- name: Install dependencies
run: go get .
- name: Run
run: go build && ./comicbot
run: go run comicbot.go
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ 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.

## Building and running with Docker

1. Build the image `docker build --tag comicbot .`
1. Run the container `docker run --env WEBHOOK_URL="<your-slack-webhook-url>" comicbot`
1. Run the container `docker run --env WEBHOOK_URL="<your-slack-webhook-url>" --env KVDB_BUCKET="<yourBucketId>" comicbot`

## Building and publishing to Dockerhub

Expand Down