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
6 changes: 1 addition & 5 deletions .github/composite/build-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,4 @@ runs:

- name: Run script
shell: bash
run: bun .github/scripts/build-image
env:
DOCKER_UPLOAD: ${{ inputs.DOCKER_UPLOAD }}
TAG_PREFIX: ${{ inputs.TAG_PREFIX }}
SERVER_PROFILES: ${{ inputs.SERVER_PROFILES }}
run: bun run .github/scripts/build-image --tag-prefix=${{ inputs.TAG_PREFIX }} --docker-upload=${{ inputs.DOCKER_UPLOAD }} --server-profiles=${{ inputs.SERVER_PROFILES }}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,4 @@ runs:

- name: Run script
shell: bash
run: bun .github/scripts/build-image/internal/standup-bot
env:
DOCKER_UPLOAD: ${{ inputs.DOCKER_UPLOAD }}
run: bun run .github/scripts/build-image/internal/standup-bot --docker-upload=${{ inputs.DOCKER_UPLOAD }}
5 changes: 1 addition & 4 deletions .github/composite/notion-checks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,4 @@ runs:
- name: Run script
id: run_script
shell: bash
run: bun .github/scripts/notion
env:
PR_ID: ${{ inputs.PR_ID }}
GET_GHA_OUTPUT: ${{ inputs.GET_GHA_OUTPUT }}
run: bun .github/scripts/notion --prId=${{ inputs.PR_ID }} --getGhaOutput=${{ inputs.GET_GHA_OUTPUT }} --githubOutput=${{ inputs.GITHUB_OUTPUT }}
4 changes: 1 addition & 3 deletions .github/composite/redeploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ runs:

- name: Run script
shell: bash
run: bun .github/scripts/redeploy
run: bun run .github/scripts/redeploy --environment=${{ inputs.ENVIRONMENT }} --sha=${{ inputs.SHA }}
env:
DOCKER_UPLOAD: ${{ inputs.DOCKER_UPLOAD }}
TAG_PREFIX: ${{ inputs.TAG_PREFIX }}
SERVER_PROFILES: ${{ inputs.SERVER_PROFILES }}
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
SHA: ${{ inputs.SHA }}
4 changes: 1 addition & 3 deletions .github/composite/test/backend-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,4 @@ runs:

- name: Run script
shell: bash
run: bun .github/scripts/test/run-backend-tests
env:
UPLOAD_TEST_COV: ${{ inputs.UPLOAD_TEST_COV }}
run: bun run .github/scripts/test/run-backend-tests --should-upload-coverage=${{ inputs.UPLOAD_TEST_COV }}
4 changes: 1 addition & 3 deletions .github/composite/test/frontend-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,4 @@ runs:

- name: Run script
shell: bash
run: bun .github/scripts/test/run-frontend-tests
env:
UPLOAD_TEST_COV: ${{ inputs.UPLOAD_TEST_COV }}
run: bun run .github/scripts/test/run-frontend-tests --should-upload-coverage=${{ inputs.UPLOAD_TEST_COV }}
5 changes: 1 addition & 4 deletions .github/composite/validate-db/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,4 @@ runs:

- name: Run script
shell: bash
run: bun .github/scripts/validate-db
env:
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
SHA: ${{ inputs.SHA }}
run: bun run .github/scripts/validate-db --environment=${{ inputs.ENVIRONMENT }} --sha=${{ inputs.SHA }}
45 changes: 25 additions & 20 deletions .github/scripts/auto-approval/index.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
import type { RestEndpointMethodTypes } from "@octokit/rest";

import { Octokit, RequestError } from "octokit";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

const AUTHORIZED_USER = "tahminator";

const githubToken = (() => {
const v = process.env.GH_TOKEN;
if (!v) {
throw new Error("GH_TOKEN is required");
}
return v;
})();
const {
githubToken,
repo: rawRepo,
prId,
} = await yargs(hideBin(process.argv))
.option("githubToken", {
type: "string",
describe: "GitHub token",
default: "",
})
.option("repo", {
type: "string",
describe: "Repository in owner/repo form",
default: "",
})
.option("prId", {
type: "number",
describe: "Pull request number",
default: 1,
})
.strict()
.parse();

const [owner, repo] = (() => {
const v = process.env.GITHUB_REPOSITORY;
const v = rawRepo;
if (!v) {
throw new Error("GITHUB_REPOSITORY is required");
}
return v.split("/") as [string, string];
})();

const prId = (() => {
const v = process.env.PR_ID;
if (!v) {
throw new Error("PR_ID is required");
}
const n = Number(v);
if (Number.isNaN(n)) {
throw new Error("PR_ID must be a number");
}
return n;
})();

async function main() {
const client = new Octokit({
auth: githubToken,
Expand Down
22 changes: 19 additions & 3 deletions .github/scripts/build-image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@ import { $ } from "bun";
import { getEnvVariables } from "load-secrets/env/load";
import { backend } from "utils/run-backend-instance";
import { db } from "utils/run-local-db";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

process.env.TZ = "America/New_York";

const tagPrefix = process.env.TAG_PREFIX || "";
const shouldDockerUpload = Boolean(process.env.DOCKER_UPLOAD) || false;
const serverProfiles = process.env.SERVER_PROFILES || "prod";
const { tagPrefix, shouldDockerUpload, serverProfiles } = await yargs(
hideBin(process.argv),
)
.option("tagPrefix", {
type: "string",
default: "",
})
.option("dockerUpload", {
type: "boolean",
default: false,
})
.option("serverProfiles", {
type: "string",
default: "prod",
})
.strict()
.parse();

async function main() {
try {
Expand Down
10 changes: 9 additions & 1 deletion .github/scripts/build-image/internal/standup-bot.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { $ } from "bun";
import { getEnvVariables } from "load-secrets/env/load";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

process.env.TZ = "America/New_York";

const shouldDockerUpload = Boolean(process.env.DOCKER_UPLOAD) || false;
const { shouldDockerUpload } = await yargs(hideBin(process.argv))
.option("dockerUpload", {
type: "boolean",
default: false,
})
.strict()
.parse();

async function main() {
const ciEnv = await getEnvVariables(["ci"]);
Expand Down
34 changes: 31 additions & 3 deletions .github/scripts/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 20 additions & 23 deletions .github/scripts/copy-prod-db/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
import { $ } from "bun";
import { updateCommitStatus } from "utils/update-commit-status";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

import { getEnvVariables } from "../load-secrets/env/load";

const AUTHORIZED_USER = "tahminator";

const username = (() => {
const v = process.env.GITHUB_ACTOR;
if (!v) {
throw new Error("GITHUB_ACTOR is required");
}
return v;
})();

const sha = (() => {
const v = process.env.SHA;
if (!v) {
throw new Error("SHA is required");
}
return v;
})();

const runUrl = (() => {
const v = process.env.RUN_URL;
if (!v) {
throw new Error("RUN_URL is required");
}
return v;
})();
const { runUrl, username, sha } = await yargs(hideBin(process.argv))
.options("runUrl", {
type: "string",
describe: "Run url for action",
default: "",
})
.options("username", {
type: "string",
describe: "Username of person who triggered action",
default: "",
})
.options("sha", {
type: "string",
describe: "Commit SHA",
default: "",
})
.strict()
.parse();

async function main() {
try {
Expand Down
21 changes: 10 additions & 11 deletions .github/scripts/help-message/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { sendMessage } from "utils/send-message";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

const prId = (() => {
const v = process.env.PR_ID;
if (!v) {
throw new Error("PR_ID is required");
}
const n = Number(v);
if (Number.isNaN(n)) {
throw new Error("PR_ID must be a number");
}
return n;
})();
const { prId } = await yargs(hideBin(process.argv))
.options("prId", {
type: "number",
describe: "Pull request number",
default: 1,
})
.strict()
.parse();

export async function main() {
await sendMessage(
Expand Down
Loading