Fix repo handling
This commit is contained in:
7
action/dist/index.js
vendored
7
action/dist/index.js
vendored
@@ -916,8 +916,7 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_actions_github_lib_gith
|
|||||||
console.log(`Dry-run | complete`)
|
console.log(`Dry-run | complete`)
|
||||||
else {
|
else {
|
||||||
//Repository
|
//Repository
|
||||||
const repo = github.context.repo.repo
|
console.log(`Repository | ${github.context.repo.owner}/${github.context.repo.repo}`)
|
||||||
console.log(`Repository | ${repo}`)
|
|
||||||
//Committer token
|
//Committer token
|
||||||
const token = core.getInput("committer_token") || core.getInput("token")
|
const token = core.getInput("committer_token") || core.getInput("token")
|
||||||
console.log(`Committer token | ${token ? "provided" : "missing"}`)
|
console.log(`Committer token | ${token ? "provided" : "missing"}`)
|
||||||
@@ -929,13 +928,13 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_actions_github_lib_gith
|
|||||||
//Retrieve previous render SHA to be able to update file content through API
|
//Retrieve previous render SHA to be able to update file content through API
|
||||||
let sha = null
|
let sha = null
|
||||||
try {
|
try {
|
||||||
const {data} = await rest.repos.getContent({owner:user, repo, path:filename})
|
const {data} = await rest.repos.getContent({...github.context.repo, path:filename})
|
||||||
sha = data.sha
|
sha = data.sha
|
||||||
} catch (error) { console.debug(error) }
|
} catch (error) { console.debug(error) }
|
||||||
console.log(`Previous render sha | ${sha || "none"}`)
|
console.log(`Previous render sha | ${sha || "none"}`)
|
||||||
//Update file content through API
|
//Update file content through API
|
||||||
await rest.repos.createOrUpdateFileContents({
|
await rest.repos.createOrUpdateFileContents({
|
||||||
owner:user, repo, path:filename, message:`Update ${filename} - [Skip GitHub Action]`,
|
...github.context.repo, path:filename, message:`Update ${filename} - [Skip GitHub Action]`,
|
||||||
content:Buffer.from(rendered).toString("base64"),
|
content:Buffer.from(rendered).toString("base64"),
|
||||||
...(sha ? {sha} : {})
|
...(sha ? {sha} : {})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -122,8 +122,7 @@
|
|||||||
console.log(`Dry-run | complete`)
|
console.log(`Dry-run | complete`)
|
||||||
else {
|
else {
|
||||||
//Repository
|
//Repository
|
||||||
const repo = github.context.repo.repo
|
console.log(`Repository | ${github.context.repo.owner}/${github.context.repo.repo}`)
|
||||||
console.log(`Repository | ${repo}`)
|
|
||||||
//Committer token
|
//Committer token
|
||||||
const token = core.getInput("committer_token") || core.getInput("token")
|
const token = core.getInput("committer_token") || core.getInput("token")
|
||||||
console.log(`Committer token | ${token ? "provided" : "missing"}`)
|
console.log(`Committer token | ${token ? "provided" : "missing"}`)
|
||||||
@@ -135,13 +134,13 @@
|
|||||||
//Retrieve previous render SHA to be able to update file content through API
|
//Retrieve previous render SHA to be able to update file content through API
|
||||||
let sha = null
|
let sha = null
|
||||||
try {
|
try {
|
||||||
const {data} = await rest.repos.getContent({owner:user, repo, path:filename})
|
const {data} = await rest.repos.getContent({...github.context.repo, path:filename})
|
||||||
sha = data.sha
|
sha = data.sha
|
||||||
} catch (error) { console.debug(error) }
|
} catch (error) { console.debug(error) }
|
||||||
console.log(`Previous render sha | ${sha || "none"}`)
|
console.log(`Previous render sha | ${sha || "none"}`)
|
||||||
//Update file content through API
|
//Update file content through API
|
||||||
await rest.repos.createOrUpdateFileContents({
|
await rest.repos.createOrUpdateFileContents({
|
||||||
owner:user, repo, path:filename, message:`Update ${filename} - [Skip GitHub Action]`,
|
...github.context.repo, path:filename, message:`Update ${filename} - [Skip GitHub Action]`,
|
||||||
content:Buffer.from(rendered).toString("base64"),
|
content:Buffer.from(rendered).toString("base64"),
|
||||||
...(sha ? {sha} : {})
|
...(sha ? {sha} : {})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user