Skip to content
This repository was archived by the owner on Mar 25, 2022. It is now read-only.

Commit

Permalink
fix: buffer files out of github with utf8 encoding, not ascii (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion authored Mar 24, 2020
1 parent 92b468c commit 9ec6e64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file.json
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function run() {
const apiSettingId = core.getInput('readme-api-id', { required: true });
const apiVersion = core.getInput('readme-api-version', { required: true });
const token = core.getInput('repo-token', { required: true });

const client = new github.GitHub(token);

const apiFile = await client.repos.getContents({
Expand All @@ -21,7 +21,7 @@ async function run() {
ref: github.context.ref,
});

fs.writeFileSync('file.json', new Buffer(apiFile.data.content, 'base64').toString('ascii'));
fs.writeFileSync('file.json', Buffer.from(apiFile.data.content, 'base64').toString('utf8'));

const options = {
formData: {
Expand All @@ -44,7 +44,7 @@ async function run() {
core.setFailed(err.message);
}
});

} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit 9ec6e64

Please sign in to comment.