initial commit
This commit is contained in:
15
.github/workflows/ci.yml
vendored
Normal file
15
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: CI
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
path: package.json
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
20
README.md
Normal file
20
README.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# read-file-action
|
||||||
|
|
||||||
|
Read file contents.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Read package.json
|
||||||
|
id: package
|
||||||
|
uses: juliangruber/read-file-action@v1
|
||||||
|
with:
|
||||||
|
path: ./package.json
|
||||||
|
- name: Echo package.json
|
||||||
|
run: echo ${{ steps.package.outputs.content }}
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
16
action.yml
Normal file
16
action.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Read file
|
||||||
|
author: juliangruber
|
||||||
|
description: 'Read file contents'
|
||||||
|
branding:
|
||||||
|
icon: 'file'
|
||||||
|
color: purple
|
||||||
|
inputs:
|
||||||
|
path:
|
||||||
|
description: 'File path'
|
||||||
|
required: true
|
||||||
|
outputs:
|
||||||
|
content:
|
||||||
|
description: 'File content'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'dist/index.js'
|
||||||
11233
dist/index.js
vendored
Normal file
11233
dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
index.js
Normal file
12
index.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const core = require('@actions/core')
|
||||||
|
const { promises: fs } = require('fs')
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const path = core.getInput('path')
|
||||||
|
const content = await fs.readFile(path, 'utf8')
|
||||||
|
core.setOutput('content', content)
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch(err => core.setFailed(err.message))
|
||||||
5540
package-lock.json
generated
Normal file
5540
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
package.json
Normal file
26
package.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "read-file-action",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"description": "Read file contents",
|
||||||
|
"repository": "juliangruber/read-file-action",
|
||||||
|
"scripts": {
|
||||||
|
"test": "prettier-standard index.js && standard index.js",
|
||||||
|
"build": "ncc build index.js",
|
||||||
|
"version": "npm run build && git add dist",
|
||||||
|
"release": "np && git tag -f v1 && git push --tags -f"
|
||||||
|
},
|
||||||
|
"np": {
|
||||||
|
"publish": false
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@zeit/ncc": "^0.20.5",
|
||||||
|
"np": "^5.1.3",
|
||||||
|
"prettier-standard": "^15.0.1",
|
||||||
|
"standard": "^14.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user