mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-02-02 21:07:50 +01:00
Working
This commit is contained in:
@@ -21,10 +21,10 @@ export async function UpdateGitHubReadme(): Promise<void> {
|
|||||||
|
|
||||||
const stats_table = `| Informations | State |
|
const stats_table = `| Informations | State |
|
||||||
| ---------------------------: | ------: |
|
| ---------------------------: | ------: |
|
||||||
| :musical_note: Music Playing | **${listening_music}** |
|
| :musical_note: Music Playing | **${getStatus(listening_music)}** |
|
||||||
| :bed: Sleeping | **${sleeping}** |
|
| :bed: Sleeping | **${getStatus(sleeping)}** |
|
||||||
| :computer: Developing | **${developing}** |
|
| :computer: Developing | **${getStatus(developing)}** |
|
||||||
| :books: Learning | **${learning}** |`
|
| :books: Learning | **${getStatus(learning)}** |`
|
||||||
|
|
||||||
let change = true;
|
let change = true;
|
||||||
|
|
||||||
@@ -46,18 +46,29 @@ export async function UpdateGitHubReadme(): Promise<void> {
|
|||||||
const old_infos_table = infos_table_check.split('###### Curious')[0]
|
const old_infos_table = infos_table_check.split('###### Curious')[0]
|
||||||
if (!old_infos_table) change = true
|
if (!old_infos_table) change = true
|
||||||
|
|
||||||
|
|
||||||
if (old_infos_table == infos_table && old_stats_table == stats_table) change = false
|
if (old_infos_table == infos_table && old_stats_table == stats_table) change = false
|
||||||
|
|
||||||
if (!change) return
|
if (!change) return
|
||||||
|
|
||||||
let new_content = content.replace(old_stats_table, stats_table);
|
let new_content = content.replace(old_stats_table, stats_table + '\n\n');
|
||||||
new_content = new_content.replace(old_infos_table, infos_table)
|
new_content = new_content.replace(old_infos_table, infos_table)
|
||||||
|
|
||||||
console.log(" NEW CONTENT ")
|
console.log(" NEW CONTENT ")
|
||||||
console.log(new_content)
|
console.log(new_content)
|
||||||
console.log(" ")
|
console.log(" ")
|
||||||
|
|
||||||
|
console.log(" INFOS ")
|
||||||
|
console.log(infos_table)
|
||||||
|
console.log(" ")
|
||||||
|
console.log(old_infos_table)
|
||||||
|
console.log(" ")
|
||||||
|
|
||||||
|
console.log(" STATS ")
|
||||||
|
console.log(stats_table)
|
||||||
|
console.log(" ")
|
||||||
|
console.log(old_stats_table)
|
||||||
|
console.log(" ")
|
||||||
|
|
||||||
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')}`
|
||||||
@@ -73,3 +84,7 @@ export async function UpdateGitHubReadme(): Promise<void> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStatus(state: boolean): string {
|
||||||
|
return state ? "Yes" : "No"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user