mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-31 03:48:03 +01:00
Catch error
This commit is contained in:
@@ -2,6 +2,7 @@ import {getDailyStats, getMonthlyStats, getTotalStats, getWeeklyStats} from "App
|
|||||||
import Redis from "@ioc:Adonis/Addons/Redis";
|
import Redis from "@ioc:Adonis/Addons/Redis";
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import Env from "@ioc:Adonis/Core/Env";
|
import Env from "@ioc:Adonis/Core/Env";
|
||||||
|
import Logger from "@ioc:Adonis/Core/Logger";
|
||||||
|
|
||||||
export async function UpdateGitHubReadme(): Promise<void> {
|
export async function UpdateGitHubReadme(): Promise<void> {
|
||||||
const daily_stats = await getDailyStats()
|
const daily_stats = await getDailyStats()
|
||||||
@@ -54,7 +55,7 @@ export async function UpdateGitHubReadme(): Promise<void> {
|
|||||||
let new_content = content.replace(old_stats_table, stats_table);
|
let new_content = content.replace(old_stats_table, stats_table);
|
||||||
new_content = new_content.replace(old_infos_table, infos_table)
|
new_content = new_content.replace(old_infos_table, infos_table)
|
||||||
|
|
||||||
await axios.put('https://api.github.com/repos/arthurdanjou/arthurdanjou/contents/README.md', {
|
await axios.put('https://api.github.com/repos/ArthurDanjou/arthurdanjou/contents/README.md', {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${Env.get('GITHUB_TOKEN')}`
|
authorization: `Bearer ${Env.get('GITHUB_TOKEN')}`
|
||||||
},
|
},
|
||||||
@@ -67,5 +68,7 @@ export async function UpdateGitHubReadme(): Promise<void> {
|
|||||||
email: 'me@arthurdanjou.fr'
|
email: 'me@arthurdanjou.fr'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
Logger.fatal(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user