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
43,132 changes: 42,735 additions & 397 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/sourcemap-register.js

This file was deleted.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@
},
"scripts": {
"build": "tsc",
"build:dist": "yarn build && ncc build -o dist --source-map",
"build:dist": "yarn build && ncc build -o dist",
"format-n-lint": "biome check",
"format-n-lint:fix": "biome check --write",
"precommit": "yarn format-n-lint:fix && yarn build:dist",
"prepare": "husky || true"
},
"dependencies": {
"@actions/core": "^1.11.1"
"@actions/core": "^1.11.1",
"jimp": "^1.6.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/node": "^22.10.2",
"@types/node": "^22.13.14",
"@vercel/ncc": "^0.38.3",
"husky": "^9.1.7",
"typescript": "^5.7.2"
"typescript": "^5.8.2"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const run = async (): Promise<void> => {
}

if (teamsURLs.length > 0) {
const teamsPayload = normalizeTeamsPayload(
const teamsPayload = await normalizeTeamsPayload(
title,
text,
color,
Expand Down
11 changes: 7 additions & 4 deletions src/normalizers/teams.normalizer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { Jimp } from 'jimp';
import type { Button, Field } from '../interfaces/input';
import type { TeamsPayload } from '../interfaces/teams-payload';

export const normalizeTeamsPayload = (
export const normalizeTeamsPayload = async (
title: string,
text: string,
color: string,
fields: Field[],
buttons: Button[],
): TeamsPayload => {
): Promise<TeamsPayload> => {
const colorStrip = new Jimp({ width: 1, height: 3, color: `#${color}` });
const colorStripBase64 = await colorStrip.getBase64('image/png');

return {
type: 'message',
attachments: [
Expand Down Expand Up @@ -46,8 +50,7 @@ export const normalizeTeamsPayload = (
width: 'Full',
},
backgroundImage: {
// TODO: Replace with base64 template, but no idea how that works...
url: `https://singlecolorimage.com/get/${color}/1x3`,
url: colorStripBase64,
fillMode: 'RepeatHorizontally',
},
},
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"module": "NodeNext",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true
"esModuleInterop": true,
"moduleResolution": "nodenext"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.test.ts"]
Expand Down
Loading