Skip to content

Commit 7bbd0f2

Browse files
Merge pull request #90 from SingularityNET-Archive:development
Update dependencies in package-lock.json
2 parents 5d94028 + 00bcda4 commit 7bbd0f2

File tree

4 files changed

+128
-6
lines changed

4 files changed

+128
-6
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# .github/workflows/commit-meeting-summaries.yml
2+
name: Commit Meeting Summaries
3+
4+
on:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 0 * * *' # Run daily at midnight
8+
9+
jobs:
10+
commit-meeting-summaries:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Retrieve Meeting Summaries
15+
id: retrieve-summaries
16+
run: |
17+
curl -X POST ${{ secrets.NETLIFY_BASE_URL }}/.netlify/functions/getMeetingSummaries \
18+
-H 'Content-Type: application/json' \
19+
-d '{}' \
20+
-o meeting-summaries.json
21+
echo "::set-output name=summaries::$(cat meeting-summaries.json)"
22+
23+
- name: Commit to GitHub
24+
run: |
25+
curl -X POST ${{ secrets.NETLIFY_BASE_URL }}/.netlify/functions/commitToGitHub \
26+
-H 'Content-Type: application/json' \
27+
-d '{
28+
"owner": "SingularityNET-Archive",
29+
"repo": "SingularityNET-Archive",
30+
"filePath": "Data/meeting-summaries.json",
31+
"content": ${{ steps.retrieve-summaries.outputs.summaries }},
32+
"commitMessage": "Update meeting summaries"
33+
}'
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// netlify/functions/commitToGitHub.js
2+
import { Octokit } from "@octokit/rest";
3+
4+
export const handler = async (event, context) => {
5+
try {
6+
const { owner, repo, filePath, content, commitMessage } = JSON.parse(event.body);
7+
8+
const octokit = new Octokit({
9+
auth: process.env.GITHUB_TOKEN,
10+
});
11+
12+
const { data } = await octokit.repos.createOrUpdateFileContents({
13+
owner,
14+
repo,
15+
path: filePath,
16+
message: commitMessage,
17+
content: Buffer.from(JSON.stringify(content, null, 2)).toString('base64'),
18+
});
19+
20+
return {
21+
statusCode: 200,
22+
body: JSON.stringify({ message: 'Data committed to GitHub successfully' }),
23+
};
24+
} catch (error) {
25+
console.error('Error in commitToGitHub function:', error);
26+
return {
27+
statusCode: 500,
28+
body: JSON.stringify({ error: 'Failed to commit data to GitHub' }),
29+
};
30+
}
31+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// netlify/functions/getMeetingSummaries.js
2+
import { supabase } from '../../lib/supabaseClient';
3+
4+
export const handler = async (event, context) => {
5+
try {
6+
const { data, error } = await supabase
7+
.from('meetingsummaries')
8+
.select('summary');
9+
10+
if (error) {
11+
console.error('Error retrieving meeting summaries:', error);
12+
return {
13+
statusCode: 500,
14+
body: JSON.stringify({ error: 'Failed to retrieve meeting summaries' }),
15+
};
16+
}
17+
18+
return {
19+
statusCode: 200,
20+
body: JSON.stringify(data),
21+
};
22+
} catch (error) {
23+
console.error('Error in getMeetingSummaries function:', error);
24+
return {
25+
statusCode: 500,
26+
body: JSON.stringify({ error: 'Internal server error' }),
27+
};
28+
}
29+
};

package-lock.json

Lines changed: 35 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)