Skip to content

Commit f23a86b

Browse files
authored
Merge pull request #230 from lelia/set-fork-url-output
Set forkUrl as Output Value
2 parents 10ce5a8 + 7abec85 commit f23a86b

File tree

7 files changed

+38
-9
lines changed

7 files changed

+38
-9
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to `Forker` will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.6] - 2022-10-12
9+
10+
### Added
11+
12+
- A new GitHub Action `output` which allows the value of the `forkUrl` string to be accessed by subsequent steps in a GitHub Workflow.
13+
14+
### Changed
15+
16+
- Upgraded action runner config to use node v16 (support for v12 is [being deprecated](https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/)).
17+
818
## [0.0.5] - 2022-09-07
919

1020
### Added

README.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ If the `checkUser` option is enabled, `forker` will check the specified GitHub o
1111

1212
For legal and compliance reasons, organizations or individuals can choose to provide an optional `licenseAllowlist` to compare against the [license of the repository](https://docs.github.com/en/rest/reference/licenses) being forked. If the license key returned by the GitHub API is not found within the provided allowlist, `forker` will exit without forking the repository, and display an error.
1313

14+
---
15+
1416
## Inputs
1517

1618
### `token` (string, required)
@@ -79,14 +81,24 @@ A newline-delimited (`"\n"`) string representing a list of allowed [license keys
7981
8082
**Example:** `"0bsd\napache-2.0\nmit"`
8183

84+
## Outputs
85+
86+
### `forkUrl` (string)
87+
88+
A string representing the HTTPS URL of the newly-forked repository.
89+
90+
**Example:** `"https://github.com/wayfair-contribs/tremor-runtime"`
91+
92+
---
93+
8294
## Usage
8395

8496
### Typical
8597

86-
In most cases, you'll want to use the latest stable version (eg. `v0.0.5`):
98+
In most cases, you'll want to use the latest stable version (eg. `v0.0.6`):
8799

88100
```yaml
89-
uses: wayfair-incubator/[email protected].5
101+
uses: wayfair-incubator/[email protected].6
90102
with:
91103
token: ${{ secrets.ACCESS_TOKEN }}
92104
repo: tremor-runtime
@@ -112,7 +124,7 @@ with:
112124
If you are automating the creation of forks on behalf of a GitHub organization with many users, you may wish to leverage the optional `checkUser`, `promoteUser`, and `licenseAllowlist` params:
113125

114126
```yaml
115-
uses: wayfair-incubator/[email protected].5
127+
uses: wayfair-incubator/[email protected].6
116128
with:
117129
token: ${{ secrets.ACCESS_TOKEN }}
118130
repo: tremor-runtime
@@ -124,6 +136,8 @@ with:
124136
licenseAllowlist: "0bsd\napache-2.0\nmit"
125137
```
126138

139+
---
140+
127141
## Developing
128142

129143
> 💡 **Tip:** Please use [node.js](https://nodejs.org/en/download/releases/) v17.x or later, as well as [TypeScript](https://www.npmjs.com/package/typescript) v4.x or later.
@@ -167,7 +181,7 @@ Then run [ncc](https://github.com/zeit/ncc) and push the results:
167181
npm run package
168182
git add dist
169183
git commit -a -m "prod dependencies"
170-
git push origin releases/v0.0.5
184+
git push origin releases/v0.0.6
171185
```
172186

173187
> 💡 **Tip:** We recommend using the `--license` option for `ncc`, which will create a license file for all of the production node modules used in your project.

action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ inputs:
3232
description: 'List of allowed licenses for repository being forked'
3333
required: false
3434
default: 'undefined'
35+
outputs:
36+
forkUrl:
37+
description: 'The URL of the forked repository'
3538
runs:
36-
using: 'node12'
39+
using: 'node16'
3740
main: 'dist/index.js'

dist/index.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "forker",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"private": true,
55
"description": "Github action for automating fork creation",
66
"main": "lib/main.js",

src/github.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ export async function forkRepo(
7373
`If this was not intentional, please check for exisiting repositories on your Github account or organization!\n`
7474
)
7575
}
76-
core.info(`🎉 Forked repository now available at: ${res.data.html_url}`)
76+
core.info(`🎉 Forked repository now available at: ${url}`)
77+
core.setOutput('forkUrl', url)
7778
}
7879
} catch (err: any) {
7980
if (err.status === HTTP.FORBIDDEN) {

0 commit comments

Comments
 (0)