Skip to content

Commit

Permalink
Merge branch 'main' into feat/change-app-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
PaolaSantolloV authored Oct 26, 2023
2 parents 59c064e + 37a2a61 commit a6c1f66
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,11 @@ jobs:
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GITHUB_KEY: ${{ secrets.API_GITHUB_KEY }}
with:
timeout: 60s
command_timeout: 30m
envs: DB_URL,DATABASE_URL,SESSION_SECRET,BASE_URL,AUTH0_CLIENT_ID,AUTH0_DOMAIN,AUTH0_CLIENT_SECRET,GOOGLE_APPLICATION_CREDENTIALS
envs: DB_URL,DATABASE_URL,SESSION_SECRET,BASE_URL,AUTH0_CLIENT_ID,AUTH0_DOMAIN,AUTH0_CLIENT_SECRET,GOOGLE_APPLICATION_CREDENTIALS,GITHUB_KEY
host: ${{ secrets.LIGHTSAIL_IP }}
username: ${{ secrets.LIGHTSAIL_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
Expand All @@ -225,6 +226,7 @@ jobs:
echo AUTH0_DOMAIN="$AUTH0_DOMAIN" >> .env
echo AUTH0_CLIENT_SECRET="$AUTH0_CLIENT_SECRET" >> .env
echo GOOGLE_APPLICATION_CREDENTIALS="$GOOGLE_APPLICATION_CREDENTIALS" >> .env
echo GITHUB_KEY="$GITHUB_KEY" >> .env
echo "*** Step: *** npm ci and build"
npm ci # install
Expand Down Expand Up @@ -316,10 +318,11 @@ jobs:
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GITHUB_KEY: ${{ secrets.API_GITHUB_KEY }}
with:
timeout: 60s
command_timeout: 30m
envs: DB_URL,DATABASE_URL,SESSION_SECRET,BASE_URL,AUTH0_CLIENT_ID,AUTH0_DOMAIN,AUTH0_CLIENT_SECRET,GOOGLE_APPLICATION_CREDENTIALS
envs: DB_URL,DATABASE_URL,SESSION_SECRET,BASE_URL,AUTH0_CLIENT_ID,AUTH0_DOMAIN,AUTH0_CLIENT_SECRET,GOOGLE_APPLICATION_CREDENTIALS,GITHUB_KEY
host: ${{ secrets.LIGHTSAIL_IP }}
username: ${{ secrets.LIGHTSAIL_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
Expand All @@ -343,6 +346,7 @@ jobs:
echo AUTH0_DOMAIN="$AUTH0_DOMAIN" >> .env
echo AUTH0_CLIENT_SECRET="$AUTH0_CLIENT_SECRET" >> .env
echo GOOGLE_APPLICATION_CREDENTIALS="$GOOGLE_APPLICATION_CREDENTIALS" >> .env
echo GITHUB_KEY="$GITHUB_KEY" >> .env
echo "*** Step: *** npm ci and build"
npm ci # install
Expand All @@ -360,7 +364,7 @@ jobs:
echo "*** Cron job to get github activity ****"
chmod +x /home/admin/projectlab/app/githubActivity.sh
{
line="0 0 * * * /home/admin/projectlab/app/githubActivity.sh"
line="0 9,21 * * * /home/admin/projectlab/app/githubActivity.sh"
crontab -l | grep -Fv "$line"
echo "$line"
} | crontab -
Expand Down
14 changes: 9 additions & 5 deletions app/routes/api/github/get-proyectActivity.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { Octokit } from "@octokit/core";
import { env } from "process";
import { saveActivity } from "../../../models/githubactivity.server";
Expand All @@ -22,11 +23,14 @@ export const getActivity = async (repo: string, projectId: string) => {
try{
const repoActivity = await octokit.request(`GET /repos/${owner}/${repoUrlClean}/events`, {
owner,
repo,
}).catch((e) => { throw(e)});

repoUrlClean,
});
console.log('limit ', repoActivity.headers["x-ratelimit-limit"]);
console.log('ratelimit-remaining ', repoActivity.headers["x-ratelimit-remaining"]);

if(repoActivity.data.length){
if(repoActivity.status != 404){
// eslint-disable-next-line no-console
console.log( repoUrlClean , repoUrlClean , repoActivity.status, repoActivity.headers["x-ratelimit-limit"], repoActivity.headers["x-ratelimit-remaining"],repoActivity.data.length);
repoActivity.data?.forEach( (activity: { id: string; type: string; created_at: string; actor: { display_login: string; avatar_url: string; }; }) => {
saveActivity(activity.id ,
activity.type?.replace(/([a-z0-9])([A-Z])/g, '$1 $2') as string, //this is for separe the string with camel case into pieces
Expand All @@ -38,7 +42,7 @@ export const getActivity = async (repo: string, projectId: string) => {


}catch(e){
console.error(e);
console.error('the repo url doesnt exit', repoUrlClean);
}

}else{
Expand Down
2 changes: 1 addition & 1 deletion app/routes/projects/$projectId/github-info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ import { useLoaderData, useSubmit } from "@remix-run/react";
<Paper sx={{ padding: 2, width: 1 }} >
<Grid container sx={{ margin: 2}} justifyContent="space-between" >
<Typography color="text.primary">
Stadistics
Statistics
</Typography>
</Grid>
<Grid container sx={{ padding: 2, width: 1 }} >
Expand Down
2 changes: 1 addition & 1 deletion app/routes/projects/$projectId/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export default function ProjectDetailsPage() {

<Card>
<CardHeader
title="Github Stadistics"
title="GitHub Statistics"
action={
<Button variant="contained" href={`/projects/${project.id}/github-info`} endIcon={<GitHub />}>
See Info
Expand Down

0 comments on commit a6c1f66

Please sign in to comment.