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
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/workflows/commit-meeting-summaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# .github/workflows/commit-meeting-summaries.yml
name: Commit Meeting Summaries

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Run daily at midnight

jobs:
commit-meeting-summaries:
runs-on: ubuntu-latest

steps:
- name: Retrieve Meeting Summaries
id: retrieve-summaries
run: |
curl -X POST ${{ secrets.NETLIFY_BASE_URL }}/.netlify/functions/getMeetingSummaries \
-H 'Content-Type: application/json' \
-d '{}' \
-o meeting-summaries.json
echo "::set-output name=summaries::$(cat meeting-summaries.json)"

- name: Commit to GitHub
run: |
curl -X POST ${{ secrets.NETLIFY_BASE_URL }}/.netlify/functions/commitToGitHub \
-H 'Content-Type: application/json' \
-d '{
"owner": "SingularityNET-Archive",
"repo": "SingularityNET-Archive",
"filePath": "Data/meeting-summaries.json",
"content": ${{ steps.retrieve-summaries.outputs.summaries }},
"commitMessage": "Update meeting summaries"
}'
31 changes: 31 additions & 0 deletions netlify/functions/commitToGitHub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// netlify/functions/commitToGitHub.js
import { Octokit } from "@octokit/rest";

export const handler = async (event, context) => {
try {
const { owner, repo, filePath, content, commitMessage } = JSON.parse(event.body);

const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN,
});

const { data } = await octokit.repos.createOrUpdateFileContents({
owner,
repo,
path: filePath,
message: commitMessage,
content: Buffer.from(JSON.stringify(content, null, 2)).toString('base64'),
});

return {
statusCode: 200,
body: JSON.stringify({ message: 'Data committed to GitHub successfully' }),
};
} catch (error) {
console.error('Error in commitToGitHub function:', error);
return {
statusCode: 500,
body: JSON.stringify({ error: 'Failed to commit data to GitHub' }),
};
}
};
29 changes: 29 additions & 0 deletions netlify/functions/getMeetingSummaries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// netlify/functions/getMeetingSummaries.js
import { supabase } from '../../lib/supabaseClient';

export const handler = async (event, context) => {
try {
const { data, error } = await supabase
.from('meetingsummaries')
.select('summary');

if (error) {
console.error('Error retrieving meeting summaries:', error);
return {
statusCode: 500,
body: JSON.stringify({ error: 'Failed to retrieve meeting summaries' }),
};
}

return {
statusCode: 200,
body: JSON.stringify(data),
};
} catch (error) {
console.error('Error in getMeetingSummaries function:', error);
return {
statusCode: 500,
body: JSON.stringify({ error: 'Internal server error' }),
};
}
};
41 changes: 35 additions & 6 deletions package-lock.json

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