diff --git a/.github/workflows/on_demand.yml b/.github/workflows/on_demand.yml index 7782005..0078c23 100644 --- a/.github/workflows/on_demand.yml +++ b/.github/workflows/on_demand.yml @@ -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 diff --git a/.github/workflows/on_schedule.yml b/.github/workflows/on_schedule.yml index f49427b..2b8b3ef 100644 --- a/.github/workflows/on_schedule.yml +++ b/.github/workflows/on_schedule.yml @@ -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 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