Skip to content

Commit cfa4027

Browse files
authored
Merge pull request #185 from fairdataihub/staging
feat: ✨ Architecture changes
2 parents ea8f2e4 + b0d94e9 commit cfa4027

88 files changed

Lines changed: 10206 additions & 1931 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-main.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
VALIDATOR_URL: ${{ secrets.VALIDATOR_URL }}
4242

4343
steps:
44-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4545

4646
- uses: ruby/setup-ruby@v1
4747
with:
@@ -50,7 +50,7 @@ jobs:
5050

5151
- run: gem install kamal
5252

53-
- uses: webfactory/ssh-agent@v0.9.0
53+
- uses: webfactory/ssh-agent@v0.10.0
5454
with:
5555
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
5656

@@ -62,13 +62,13 @@ jobs:
6262
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
6363

6464
- name: Set up Docker Buildx for cache
65-
uses: docker/setup-buildx-action@v3
65+
uses: docker/setup-buildx-action@v4
6666

6767
- run: kamal version
6868

6969
# Setup kamal for the first time
7070
# Might need to run `sudo usermod -aG docker $USER | newgrp docker | docker ps` to add the user to the docker group if the user is not already in the docker group
71-
# - run: kamal setup
71+
# - run: kamal setup
7272

7373
# Login to the registry on the server
7474
- run: kamal registry login
@@ -103,15 +103,19 @@ jobs:
103103
GH_OAUTH_APP_ID: ${{ secrets.GH_OAUTH_APP_ID }}
104104
GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }}
105105
GH_OAUTH_CLIENT_SECRET: ${{ secrets.GH_OAUTH_CLIENT_SECRET }}
106+
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
106107
UI_LOGWATCH_URL: ${{ secrets.UI_LOGWATCH_URL }}
108+
VALIDATOR_URL: ${{ secrets.VALIDATOR_URL }}
109+
CODEFAIR_APP_DOMAIN: ${{ secrets.CODEFAIR_APP_DOMAIN }}
110+
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
107111
ZENODO_API_ENDPOINT: ${{ secrets.ZENODO_API_ENDPOINT }}
108112
ZENODO_ENDPOINT: ${{ secrets.ZENODO_ENDPOINT }}
109113
ZENODO_CLIENT_ID: ${{ secrets.ZENODO_CLIENT_ID }}
110114
ZENODO_CLIENT_SECRET: ${{ secrets.ZENODO_CLIENT_SECRET }}
111115
ZENODO_REDIRECT_URI: ${{ secrets.ZENODO_REDIRECT_URI }}
112116

113117
steps:
114-
- uses: actions/checkout@v4
118+
- uses: actions/checkout@v6
115119

116120
- uses: ruby/setup-ruby@v1
117121
with:
@@ -120,7 +124,7 @@ jobs:
120124

121125
- run: gem install kamal
122126

123-
- uses: webfactory/ssh-agent@v0.9.0
127+
- uses: webfactory/ssh-agent@v0.10.0
124128
with:
125129
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
126130

@@ -132,13 +136,13 @@ jobs:
132136
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
133137

134138
- name: Set up Docker Buildx for cache
135-
uses: docker/setup-buildx-action@v3
139+
uses: docker/setup-buildx-action@v4
136140

137141
- run: kamal version
138142

139143
# Setup kamal for the first time
140144
# Might need to run `sudo usermod -aG docker $USER | newgrp docker | docker ps` to add the user to the docker group if the user is not already in the docker group
141-
# - run: kamal setup
145+
# - run: kamal setup
142146

143147
# Login to the registry on the server
144148
- run: kamal registry login
@@ -151,7 +155,7 @@ jobs:
151155
# Deploy the app for all other times
152156
- run: kamal redeploy
153157
# - run: kamal redeploy --verbose
154-
158+
155159
deploy-validator:
156160
runs-on: ubuntu-latest
157161
environment: prd
@@ -169,7 +173,7 @@ jobs:
169173
KAMAL_APP_NAME_VALIDATOR: ${{ secrets.KAMAL_APP_NAME_VALIDATOR }}
170174

171175
steps:
172-
- uses: actions/checkout@v4
176+
- uses: actions/checkout@v6
173177

174178
- uses: ruby/setup-ruby@v1
175179
with:
@@ -178,7 +182,7 @@ jobs:
178182

179183
- run: gem install kamal
180184

181-
- uses: webfactory/ssh-agent@v0.9.0
185+
- uses: webfactory/ssh-agent@v0.10.0
182186
with:
183187
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
184188

@@ -190,13 +194,13 @@ jobs:
190194
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
191195

192196
- name: Set up Docker Buildx for cache
193-
uses: docker/setup-buildx-action@v3
197+
uses: docker/setup-buildx-action@v4
194198

195199
- run: kamal version
196200

197201
# Setup kamal for the first time
198202
# Might need to run `sudo usermod -aG docker $USER | newgrp docker | docker ps` to add the user to the docker group if the user is not already in the docker group
199-
# - run: kamal setup
203+
# - run: kamal setup
200204

201205
# Login to the registry on the server
202206
- run: kamal registry login
@@ -220,11 +224,11 @@ jobs:
220224
DATABASE_URL: ${{ secrets.DATABASE_URL }}
221225

222226
steps:
223-
- uses: actions/checkout@v3
227+
- uses: actions/checkout@v6
224228

225-
- uses: actions/setup-node@v3
229+
- uses: actions/setup-node@v6
226230
with:
227-
node-version: 20
231+
node-version: 24
228232

229233
- run: yarn install
230234

.github/workflows/deploy-staging.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
VALIDATOR_URL: ${{ secrets.VALIDATOR_URL }}
4242

4343
steps:
44-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4545

4646
- uses: ruby/setup-ruby@v1
4747
with:
@@ -50,7 +50,7 @@ jobs:
5050

5151
- run: gem install kamal
5252

53-
- uses: webfactory/ssh-agent@v0.9.0
53+
- uses: webfactory/ssh-agent@v0.10.0
5454
with:
5555
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
5656

@@ -62,13 +62,13 @@ jobs:
6262
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
6363

6464
- name: Set up Docker Buildx for cache
65-
uses: docker/setup-buildx-action@v3
65+
uses: docker/setup-buildx-action@v4
6666

6767
- run: kamal version
6868

6969
# Setup kamal for the first time
7070
# Might need to run `sudo usermod -aG docker $USER | newgrp docker | docker ps` to add the user to the docker group if the user is not already in the docker group
71-
# - run: kamal setup
71+
# - run: kamal setup
7272

7373
# Login to the registry on the server
7474
- run: kamal registry login
@@ -103,15 +103,19 @@ jobs:
103103
GH_OAUTH_APP_ID: ${{ secrets.GH_OAUTH_APP_ID }}
104104
GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }}
105105
GH_OAUTH_CLIENT_SECRET: ${{ secrets.GH_OAUTH_CLIENT_SECRET }}
106+
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
106107
UI_LOGWATCH_URL: ${{ secrets.UI_LOGWATCH_URL }}
108+
VALIDATOR_URL: ${{ secrets.VALIDATOR_URL }}
109+
CODEFAIR_APP_DOMAIN: ${{ secrets.CODEFAIR_APP_DOMAIN }}
110+
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
107111
ZENODO_API_ENDPOINT: ${{ secrets.ZENODO_API_ENDPOINT }}
108112
ZENODO_ENDPOINT: ${{ secrets.ZENODO_ENDPOINT }}
109113
ZENODO_CLIENT_ID: ${{ secrets.ZENODO_CLIENT_ID }}
110114
ZENODO_CLIENT_SECRET: ${{ secrets.ZENODO_CLIENT_SECRET }}
111115
ZENODO_REDIRECT_URI: ${{ secrets.ZENODO_REDIRECT_URI }}
112116

113117
steps:
114-
- uses: actions/checkout@v4
118+
- uses: actions/checkout@v6
115119

116120
- uses: ruby/setup-ruby@v1
117121
with:
@@ -120,7 +124,7 @@ jobs:
120124

121125
- run: gem install kamal
122126

123-
- uses: webfactory/ssh-agent@v0.9.0
127+
- uses: webfactory/ssh-agent@v0.10.0
124128
with:
125129
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
126130

@@ -132,13 +136,13 @@ jobs:
132136
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
133137

134138
- name: Set up Docker Buildx for cache
135-
uses: docker/setup-buildx-action@v3
139+
uses: docker/setup-buildx-action@v4
136140

137141
- run: kamal version
138142

139143
# Setup kamal for the first time
140144
# Might need to run `sudo usermod -aG docker $USER | newgrp docker | docker ps` to add the user to the docker group if the user is not already in the docker group
141-
# - run: kamal setup
145+
# - run: kamal setup
142146

143147
# Login to the registry on the server
144148
- run: kamal registry login
@@ -169,7 +173,7 @@ jobs:
169173
KAMAL_APP_NAME_VALIDATOR: ${{ secrets.KAMAL_APP_NAME_VALIDATOR }}
170174

171175
steps:
172-
- uses: actions/checkout@v4
176+
- uses: actions/checkout@v6
173177

174178
- uses: ruby/setup-ruby@v1
175179
with:
@@ -178,7 +182,7 @@ jobs:
178182

179183
- run: gem install kamal
180184

181-
- uses: webfactory/ssh-agent@v0.9.0
185+
- uses: webfactory/ssh-agent@v0.10.0
182186
with:
183187
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
184188

@@ -190,13 +194,13 @@ jobs:
190194
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
191195

192196
- name: Set up Docker Buildx for cache
193-
uses: docker/setup-buildx-action@v3
197+
uses: docker/setup-buildx-action@v4
194198

195199
- run: kamal version
196200

197201
# Setup kamal for the first time
198202
# Might need to run `sudo usermod -aG docker $USER | newgrp docker | docker ps` to add the user to the docker group if the user is not already in the docker group
199-
# - run: kamal setup
203+
# - run: kamal setup
200204

201205
# Login to the registry on the server
202206
- run: kamal registry login
@@ -220,11 +224,11 @@ jobs:
220224
DATABASE_URL: ${{ secrets.DATABASE_URL }}
221225

222226
steps:
223-
- uses: actions/checkout@v3
227+
- uses: actions/checkout@v6
224228

225-
- uses: actions/setup-node@v3
229+
- uses: actions/setup-node@v6
226230
with:
227-
node-version: 20
231+
node-version: 24
228232

229233
- run: yarn install
230234

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ See our [dedicated webpage](https://docs.codefair.io/docs/installation.html) for
7373

7474
---
7575

76-
## For Contributors
76+
Codefair is developed using [Octokit](https://github.com/octokit) and [Nuxt](https://nuxt.com/), and is deployed on a virtual machine hosted on Azure. The GitHub app is configured to receive webhooks for important actions such as pushing code, opening or closing issues, opening or merging pull requests, and commenting on discussions. These events drive Codefair's automated workflows, enabling seamless integration with GitHub's features and functionality.
7777

7878
### Contributing
7979

bot.ps1

Lines changed: 0 additions & 2 deletions
This file was deleted.

bot.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

bot/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM node:20-slim AS builder
2+
FROM node:22-slim AS builder
33

44
# Combine RUN commands to reduce layers and cleanup in the same layer
55
RUN apt-get update -y \
@@ -26,7 +26,7 @@ RUN yarn install --frozen-lockfile --production \
2626
&& yarn cache clean
2727

2828
# App stage
29-
FROM node:20-slim
29+
FROM node:22-slim
3030

3131
LABEL maintainer="FAIR Data Innovations Hub <contact@fairdataihub.org>"
3232
LABEL description="Your coding assistant to make research software reusable without breaking a sweat!"

bot/Dockerfile.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM node:20-slim AS builder
2+
FROM node:22-slim AS builder
33

44
# Combine RUN commands to reduce layers and cleanup in the same layer
55
RUN apt-get update -y \
@@ -19,7 +19,7 @@ RUN yarn install --frozen-lockfile --production \
1919
&& yarn cache clean
2020

2121
# App stage
22-
FROM node:20-slim
22+
FROM node:22-slim
2323

2424
LABEL maintainer="FAIR Data Innovations Hub <contact@fairdataihub.org>"
2525
LABEL description="Your coding assistant to make research software reusable without breaking a sweat!"

bot/handlers/issue.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ export function registerIssueHandlers(app, db) {
9494
});
9595

9696
if (installation) {
97+
// Repository is managed by the Nuxt central API
98+
if (installation.use_central_api) {
99+
logwatch.info(
100+
`[issues.edited] ${context.payload.repository.name} uses central API, skipping Probot handler`
101+
);
102+
return;
103+
}
104+
97105
// Verify for repository name change
98106
verifyRepoName(
99107
installation.repo,
@@ -153,6 +161,15 @@ export function registerIssueHandlers(app, db) {
153161
const issueAuthor = context.payload.issue.user.login;
154162

155163
if (issueTitle === ISSUE_TITLE && issueAuthor === `${GH_APP_NAME}[bot]`) {
164+
const installation = await db.installation.findUnique({
165+
where: { id: repository.id },
166+
});
167+
if (installation?.use_central_api) {
168+
logwatch.info(
169+
`[issues.reopened] ${repository.name} uses central API, skipping Probot handler`
170+
);
171+
return;
172+
}
156173
// Check if the repository is empty
157174
const emptyRepo = await isRepoEmpty(context, owner, repository.name);
158175

bot/handlers/pullRequest.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ export function registerPullRequestHandlers(app, db) {
6363
}
6464
}
6565

66-
// Re-render dashboard from database (no compliance checks needed - code hasn't merged yet)
67-
logwatch.info("PR opened, re-rendering dashboard to show PR badge");
68-
await reRenderDashboard(context, owner, repository, "");
66+
// skip for central-API repos
67+
if (!installation.use_central_api) {
68+
logwatch.info("PR opened, re-rendering dashboard to show PR badge");
69+
await reRenderDashboard(context, owner, repository, "");
70+
}
6971
});
7072

7173
// When a pull request is closed
@@ -79,6 +81,10 @@ export function registerPullRequestHandlers(app, db) {
7981
const { repository } = context.payload;
8082
const prTitle = context.payload.pull_request.title;
8183

84+
const installation = await db.installation.findUnique({
85+
where: { id: repository.id },
86+
});
87+
8288
// Clear PR URL from database based on PR type
8389
if (prTitle === PR_TITLES.license) {
8490
const response = await db.licenseRequest.update({
@@ -105,11 +111,11 @@ export function registerPullRequestHandlers(app, db) {
105111
}
106112
}
107113

108-
// Re-render dashboard from database (no compliance checks needed)
109-
// If PR was merged, the push event will trigger full compliance checks
110-
// If PR was closed without merge, we just need to remove the PR badge
111-
logwatch.info("PR closed, re-rendering dashboard to remove PR badge");
112-
await reRenderDashboard(context, owner, repository, "");
114+
// skip for central-API repos
115+
if (!installation.use_central_api) {
116+
logwatch.info("PR closed, re-rendering dashboard to remove PR badge");
117+
await reRenderDashboard(context, owner, repository, "");
118+
}
113119

114120
// Delete the branch
115121
const branchName = context.payload.pull_request.head.ref;

0 commit comments

Comments
 (0)