Skip to content

Commit

Permalink
Clean up and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
parno committed Nov 26, 2024
1 parent b9251ac commit 323992e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/actions/latest-github-release/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
Derived from https://github.com/marketplace/actions/get-latest-release


## Updating the code

### Setup

1. Install `vercel/ncc` by running this command in your terminal: `npm i -g @vercel/ncc`
2. Install modules. I think this means running:
```
npm install @actions/core
npm install @actions/github
npm install @octokit/rest
```
### Updates
After you change `main.js`, you need to run `ncc build main.js --license licenses.txt`,
which will update `dist/index.js`.
## References
- [GitHub REST APIs](https://docs.github.com/en/rest/releases/releases)
- [GitHub REST API Guide](https://docs.github.com/en/rest/guides/scripting-with-the-rest-api-and-javascript?apiVersion=2022-11-28)
- [Octokit docs](https://octokit.github.io/rest.js/v21/)
- [Creating a JavaScript action](https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-javascript-action)
- [Another examples of getting releases](https://github.com/InsonusK/get-latest-release)
- [Writing GitHub workflows](https://docs.github.com/en/actions/writing-workflows/)
8 changes: 5 additions & 3 deletions .github/actions/latest-github-release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ inputs:
repository:
description: 'The repository name in full'
required: false
excludes:
description: 'Types of releases to exclude (e.g. pre-release)'
required: false
# excludes:
# description: 'Types of releases to exclude (e.g. pre-release)'
# required: false
token:
description: 'The GitHub token or personal access token'
required: false
platform:
description: 'Desired platform for the release'
required: true

outputs:
# release:
# description: 'Latest release name'
url:
description: 'URL to use when downloading the release'

runs:
using: 'node20'
main: 'dist/index.js'
2 changes: 1 addition & 1 deletion .github/actions/latest-github-release/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31144,7 +31144,7 @@ const repository = core.getInput('repository');
const token = core.getInput('token');
var owner = core.getInput('owner');
var repo = core.getInput('repo');
var excludes = core.getInput('excludes').trim().split(",");
//var excludes = core.getInput('excludes').trim().split(",");
var platform = core.getInput('platform');

const octokit = (() => {
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/latest-github-release/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const repository = core.getInput('repository');
const token = core.getInput('token');
var owner = core.getInput('owner');
var repo = core.getInput('repo');
var excludes = core.getInput('excludes').trim().split(",");
//var excludes = core.getInput('excludes').trim().split(",");
var platform = core.getInput('platform');

const octokit = (() => {
Expand Down

0 comments on commit 323992e

Please sign in to comment.