Skip to content

Commit

Permalink
Merge pull request #15 from pavlovcik/development
Browse files Browse the repository at this point in the history
fix: rendering
  • Loading branch information
0x4007 authored Feb 24, 2024
2 parents d7dd9ed + 4a39b14 commit 1e8d5b0
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SUPABASE_URL=
SUPABASE_KEY=
SUPABASE_ANON_KEY=
46 changes: 33 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
name: Build
name: Build & Deploy

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v2
- name: Check out repository
uses: actions/checkout@v4
# with:
# submodules: "recursive" # Ensures submodules are checked out

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- name: Install dependencies
run: yarn install
node-version: 20.10.0

- name: Build
run: yarn build
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
yarn
yarn build
env: # Set environment variables for the build
SUPABASE_URL: "https://wfzpewmlyiozupulbuur.supabase.co"
SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs"

- name: Deploy to Cloudflare
uses: ubiquity/cloudflare-deploy-action@main
with:
repository: ${{ github.repository }}
production_branch: ${{ github.event.repository.default_branch }}
output_directory: "static"
current_branch: ${{ github.ref_name }}
pull_request_number: ${{ github.event.pull_request.number }}
commit_sha: ${{ github.event.pull_request.head.sha }}
23 changes: 0 additions & 23 deletions .github/workflows/cloudflare-deploy.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cp .env.example .env
```

Ensure that `SUPABASE_URL` and `SUPABASE_KEY` are set. This is for GitHub user registration on login.
Ensure that `SUPABASE_URL` and `SUPABASE_ANON_KEY` are set. This is for GitHub user registration on login.

```sh
yarn
Expand Down
2 changes: 1 addition & 1 deletion build/esbuild-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const cssEntries = ["static/style/style.css"];
const entries = [...typescriptEntries, ...cssEntries, "static/manifest.json", "static/favicon.svg", "static/icon-512x512.png"];

export const esBuildContext: esbuild.BuildOptions = {
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_KEY"]),
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"]),
plugins: [invertColors, pwaManifest],
sourcemap: true,
entryPoints: entries,
Expand Down
12 changes: 8 additions & 4 deletions src/home/rendering/render-github-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ export function renderGitHubIssues(tasks: TaskMaybeFull[]) {
for (const task of tasks) {
if (!existingIssueIds.has(task.preview.id.toString())) {
const issueWrapper = everyNewIssue({ taskPreview: task, container });
setTimeout(() => issueWrapper.classList.add("active"), delay);
delay += baseDelay;
if (issueWrapper) {
setTimeout(() => issueWrapper.classList.add("active"), delay);
delay += baseDelay;
}
}
}
container.classList.add("ready");
Expand All @@ -47,12 +49,14 @@ function everyNewIssue({ taskPreview, container }: { taskPreview: TaskMaybeFull;
const organizationName = match?.[1];

if (!organizationName) {
throw new Error(`No organization name found for issue ${taskPreview.preview.id}.`);
console.warn(`No organization name found for issue ${taskPreview.preview.id}.`);
return;
}

const repositoryName = match?.[2];
if (!repositoryName) {
throw new Error("No repository name found");
console.warn("No repository name found");
return;
}
const labels = parseAndGenerateLabels(taskPreview);
setUpIssueElement(issueElement, taskPreview, organizationName, repositoryName, labels, match);
Expand Down
4 changes: 2 additions & 2 deletions src/home/rendering/render-github-login-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { toolbar } from "../ready-toolbar";

const supabaseUrl = process.env.SUPABASE_URL;
if (!supabaseUrl) throw new Error("SUPABASE_URL not found");
const supabaseAnonKey = process.env.SUPABASE_KEY;
if (!supabaseAnonKey) throw new Error("SUPABASE_KEY not found");
const supabaseAnonKey = process.env.SUPABASE_ANON_KEY;
if (!supabaseAnonKey) throw new Error("SUPABASE_ANON_KEY not found");

const supabase = createClient(supabaseUrl, supabaseAnonKey);

Expand Down

0 comments on commit 1e8d5b0

Please sign in to comment.