Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jan 28, 2022
1 parent 223552b commit bb2f3bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
if: ${{ github.event.pull_request.merged == true}}
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.TOKEN }}
- run: yarn
- uses: ./
with:
Expand Down
15 changes: 5 additions & 10 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getInput, setFailed, setOutput } from '@actions/core';
import { readFile, writeFile, writeFileSync } from 'fs';
import { getInput, setFailed } from '@actions/core';
import { readFile, writeFile } from 'fs';
import { promisify } from 'util';

const readFileAsync = promisify(readFile);
Expand All @@ -10,19 +10,14 @@ main().catch((error) => setFailed(error.message));
async function main() {
const CHANGELOG_PATH = './CHANGELOG.md';
try {
const pullRequest = getInput('pull_request');
console.log('------------');
console.log(pullRequest);
console.log(pullRequest.merged_at);
console.log(typeof pullRequest);
console.log(Object.keys(pullRequest));
const { merged_at, title, html_url } = JSON.parse(getInput('pull_request'));

const logLine = `**${pullRequest.merged_at}:** [${pullRequest.title}](${pullRequest.html_url})`;
const logLine = `**${merged_at}:** [${title}](${html_url})`;
console.log(logLine);

const contents = await readFileAsync(CHANGELOG_PATH);

await writeFileSync(CHANGELOG_PATH, `${logLine}\n${contents}`);
await writeFileAsync(CHANGELOG_PATH, `${logLine}\n${contents}`);
console.log('done');
} catch (error) {
setFailed(error.message);
Expand Down

0 comments on commit bb2f3bd

Please sign in to comment.