Skip to content
Merged
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
57 changes: 57 additions & 0 deletions .github/workflows/_auto-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Auto Tag

on:
workflow_call:
outputs:
new_tag:
description: "The new tag"
value: ${{ jobs.tag.outputs.new_tag }}

jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
new_tag: ${{ steps.tag.outputs.new_tag }}
steps:
- name: 🏧 Checkout code
uses: actions/checkout@v5
with:
fetch-depth: '0'

- name: 🚀 Bump version and push tag
uses: anothrNick/github-tag-action@1.75.0
id: tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DRY_RUN: ${{ github.event_name == 'pull_request' }}

- name: 📤 Show outputs
run: |
echo "Tag: ${{ steps.tag.outputs.tag }}"
echo "New tag: ${{ steps.tag.outputs.new_tag }}"
echo "Part: ${{ steps.tag.outputs.part }}"

- name: 👀 Add comment to PR
if: ${{ github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Auto Tag: after merging this PR, the new tag will be: ${{ steps.tag.outputs.new_tag }}

<details>
<summary>Details</summary>

Job: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

Use in commit message to bump:
* `#patch` - v0.0.X -> v0.0.(X+1)
* `#minor` (default) - v0.X.0 -> v0.(X+1).0
* `#major` - vX.0.0 -> v(X+1).0.0

</details>
comment_tag: autotag
57 changes: 57 additions & 0 deletions .github/workflows/_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Docker

on:
workflow_call:
inputs:
version:
type: string
description: "The version to build and push"
required: true

env:
IMAGE_NAME: discord-bot

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into GitHub Container Registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/boar-network/${{ env.IMAGE_NAME }}
tags: |
type=sha
${{ github.ref == 'refs/heads/main' && format('type=raw,value={0}', inputs.version) || '' }}
type=ref,event=branch
type=ref,event=pr

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
22 changes: 22 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
auto-tag:
uses: ./.github/workflows/_auto-tag.yaml
secrets: inherit

docker:
needs: [auto-tag]
uses: ./.github/workflows/_docker.yaml
secrets: inherit
with:
version: ${{ needs.auto-tag.outputs.new_tag }}
63 changes: 0 additions & 63 deletions .github/workflows/docker.yml

This file was deleted.

2 changes: 1 addition & 1 deletion cron/thread-lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = {
const archiveThreshold = weekdaysBefore(moment(), 4)

channels
.filter((channel) => channel.isText() && channel.viewable)
.filter((channel) => channel && channel.isText() && channel.viewable)
.forEach(async (channel) => {
const threads = await channel.threads.fetch()
threads.threads.forEach(async (thread) => {
Expand Down
Loading