Skip to content

Commit

Permalink
Add changelog workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cartermckinnon committed Oct 12, 2023
1 parent fff4aaa commit 86c9f9f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/update-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
jobs:
setup:
# this workflow will always fail in forks; bail if this isn't running in the upstream
#if: github.repository == 'awslabs/amazon-eks-ami'
if: github.repository == 'awslabs/amazon-eks-ami'
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.variables.outputs.tag_name }}
Expand All @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
repository: cartermckinnon/amazon-eks-ami
repository: awslabs/amazon-eks-ami
ref: refs/heads/master
path: amazon-eks-ami/
- uses: actions/github-script@v6
Expand All @@ -33,19 +33,15 @@ jobs:
const changelogPath = './amazon-eks-ami/CHANGELOG.md';
const placeholder = '<!--new-changelog-entry-placeholder-->';
const tagName = '${{ needs.setup.outputs.tag_name }}';
console.log(context.repo.owner);
console.log(context.repo.repo);
const release = await github.rest.repos.getReleaseByTag({
tag: tagName,
owner: context.repo.owner,
repo: context.repo.repo,
});
const newEntry = `### ${release.data.title}\n${release.data.body}`;
console.log(newEntry);
const newEntry = `### ${release.data.name}\n${release.data.body}`;
const changelog = fs.readFileSync(changelogPath);
const updatedChangelog = changelog.toString().replace(placeholder, placeholder + '\n\n' + newEntry);
fs.writeFileSync(changelogPath, updatedChangelog);
console.log(updatedChangelog);
- uses: peter-evans/create-pull-request@v4
with:
branch: update-changelog
Expand Down

0 comments on commit 86c9f9f

Please sign in to comment.