-
I'm using this code to get the latest const commit = await octokit.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'master'
});
octokit.repos.createOrUpdateFileContents({
sha: commit.data.sha,
owner: context.repo.owner,
repo: context.repo.repo,
path: 'README.md',
message: 'Update README',
content: 'VGVzdCB0ZXN0',
commiter: {
name: 'update-readme-bot',
email: '[email protected]'
},
author: {
name: 'update-readme-bot',
email: '[email protected]'
}
}); But I keep getting this error:
What Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
gr2m
Jul 21, 2020
Replies: 1 comment 2 replies
-
What you want is the file sha, not the commit sha. You can get the file sha using |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ahmedk92
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What you want is the file sha, not the commit sha. You can get the file sha using
octokit.repos.getContents({owner, repo, path})
. The response data includessha
, which is the sha you need to set when updating the file.