forked from Kellojo/github-release-notes-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated code to get all release notes
- Loading branch information
1 parent
f120c96
commit 1c7e35e
Showing
6 changed files
with
85 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"files.associations": { | ||
"*.yaml": "home-assistant" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,55 @@ | ||
# github-release-notes-generator | ||
|
||
A small little node module that converts release notes of github releases into a `json` format | ||
|
||
This action is based on the idea of @Kellojo, so basically all the credits belong to him. | ||
I modified his code to get all the release notes and not only a specific version. | ||
|
||
It creates a json file with the following contents: | ||
``` | ||
{ | ||
"name": "Now featuring Planned Transactions", | ||
"url": "https://github.com/Kellojo/Budget-Book/releases/tag/untagged-605ac3664b967afc4552", | ||
"version": "v1.3.0", | ||
"creationDate": "2021-02-07T13:36:50Z", | ||
"releaseDate": "2021-05-22T12:37:31.093Z", | ||
"description": "In this release, you can now start planning recurring transactions with the new transaction planning feature.\r\nThis way you can easily automate your income and expense tracking for recurring payments (i.e. rent, salary, etc.).\r\nTransactions can be planned to recur on a daily, weekly, monthly, yearly basis.\r\n\r\nOther smaller enhancements have been added:\r\n- Besides that you can now find the used open source packages in the user help menu.\r\n- The onboarding has been updated to showcase the features of the app\r\n- Some smaller UI enhancements have been added\r\n- The app is now signed and notarized for (Mac OS only). This makes installation easier, as Mac OS will no longer show it as an untrusted app. \r\n- The MIT license has been removed and the project is from now on licensed under the [Commons Clause license](https://commonsclause.com/)", | ||
"author": "Kellojo", | ||
"authorAvatar": "https://avatars.githubusercontent.com/u/12833426?v=4" | ||
} | ||
|
||
```json | ||
[ | ||
{ | ||
"name": "Now featuring Planned Transactions", | ||
"url": "https://github.com/Kellojo/Budget-Book/releases/tag/untagged-605ac3664b967afc4552", | ||
"version": "v1.3.0", | ||
"creationDate": "2021-02-07T13:36:50Z", | ||
"releaseDate": "2021-05-22T12:37:31.093Z", | ||
"description": "In this release, you can now start planning recurring transactions with the new transaction planning feature.\r\nThis way you can easily automate your income and expense tracking for recurring payments (i.e. rent, salary, etc.).\r\nTransactions can be planned to recur on a daily, weekly, monthly, yearly basis.\r\n\r\nOther smaller enhancements have been added:\r\n- Besides that you can now find the used open source packages in the user help menu.\r\n- The onboarding has been updated to showcase the features of the app\r\n- Some smaller UI enhancements have been added\r\n- The app is now signed and notarized for (Mac OS only). This makes installation easier, as Mac OS will no longer show it as an untrusted app. \r\n- The MIT license has been removed and the project is from now on licensed under the [Commons Clause license](https://commonsclause.com/)", | ||
"author": "Kellojo", | ||
"authorAvatar": "https://avatars.githubusercontent.com/u/12833426?v=4" | ||
}, | ||
{ | ||
"name": "Cool Release", | ||
"url": "https://github.com/Kellojo/Budget-Book/releases/tag/untagged-605ac3664b967afc4552", | ||
"version": "v1.2.0", | ||
"creationDate": "2021-02-06T12:35:40Z", | ||
"releaseDate": "2021-0-22T12:37:31.093Z", | ||
"description": "Some cool release notes", | ||
"author": "Kellojo", | ||
"authorAvatar": "https://avatars.githubusercontent.com/u/12833426?v=4" | ||
} | ||
] | ||
``` | ||
|
||
This file can then be used to i.e. create a release notes dialog within an app or something else. | ||
|
||
|
||
## Inputs | ||
|
||
### `github-access-token` | ||
|
||
**Required** The GitHub access token. This is required to create the release notes. Default ``. | ||
|
||
### `destination` | ||
**Required** Where should the resulting release notes be saved to (i.e. `./config/release-notes.json`)? Default ``. | ||
|
||
### `version` | ||
The version to create the release notes for. If none is supplied, the package.json is read to get the version. | ||
|
||
**Required** Where should the resulting release notes be saved to (i.e. `./config/release-notes.json`)? Default ``. | ||
|
||
## Example usage | ||
|
||
``` | ||
```yaml | ||
- name: Create Release Notes | ||
uses: Kellojo/github-release-notes-generator@v1.4 | ||
uses: Jerome1998/github-release-notes-generator@v1.0 | ||
with: | ||
destination: './config/release-notes.json' | ||
github-access-token: ${{ secrets.github_token }} | ||
github-access-token: ${{ secrets.GITHUB_TOKEN }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,23 @@ | ||
const core = require('@actions/core'); | ||
const github = require('@actions/github'); | ||
const {ReleaseNotesGenerator} = require("./release-notes-generator"); | ||
const fs = require('fs'); | ||
|
||
const readPackageJson = function () { | ||
const sFile = fs.readFileSync('./package.json').toString(); | ||
|
||
try { | ||
return JSON.parse(sFile); | ||
} catch (error) { | ||
|
||
} | ||
|
||
return null; | ||
} | ||
const core = require("@actions/core"); | ||
const github = require("@actions/github"); | ||
const { ReleaseNotesGenerator } = require("./release-notes-generator"); | ||
|
||
const sRepo = github.context.repo.repo; | ||
const sOwner = github.context.repo.owner | ||
const sVersion = core.getInput("version") || readPackageJson().version; | ||
const sAuthToken = core.getInput("github-access-token"); | ||
const sFilePath = core.getInput("destination"); | ||
|
||
if (!sRepo) { core.error("no repository specified, aborting"); } | ||
if (!sOwner) { core.error("no owner specified, aborting"); } | ||
if (!sVersion) { core.error("no version specified, aborting"); } | ||
if (!sAuthToken) { core.error("no GitHub access token specified, aborting"); } | ||
|
||
|
||
|
||
|
||
|
||
const run = async function () { | ||
new ReleaseNotesGenerator(sAuthToken, sOwner, sRepo, sVersion).createReleaseNotes(sFilePath); | ||
new ReleaseNotesGenerator(sAuthToken, sOwner, sRepo).createReleaseNotes(sFilePath); | ||
} | ||
|
||
try { | ||
run(); | ||
run(); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
core.setFailed(error.message); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters