Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivr/inject-command-action
GitHub action to inject the output of a command into a file of your repo.
https://github.com/olivr/inject-command-action
actions github open-source
Last synced: about 20 hours ago
JSON representation
GitHub action to inject the output of a command into a file of your repo.
- Host: GitHub
- URL: https://github.com/olivr/inject-command-action
- Owner: Olivr
- License: apache-2.0
- Created: 2020-05-12T08:15:05.000Z (almost 5 years ago)
- Default Branch: v1
- Last Pushed: 2023-01-06T05:40:22.000Z (about 2 years ago)
- Last Synced: 2025-01-31T00:18:10.615Z (11 days ago)
- Topics: actions, github, open-source
- Language: JavaScript
- Size: 1000 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Inject command action
[![tests](https://github.com/olivr-com/inject-command-action/workflows/tests/badge.svg)](https://github.com/olivr-com/inject-command-action/actions?query=workflow%3Atests)
GitHub action to inject the output of a command into a file of your repo.
We use this action to generate certain parts of our README with some third-party CLI tools.
## Usage
### Simple example
It will look for **two occurences** of `` in the file `README.md` and inject the output of `pwd | sed 's/\// /g'` between these two occurences. If this action can't find these occurences, it will inject the output at the end of the `README.md` file.
```yaml
uses: olivr-com/inject-command-action@v1
with:
command: pwd | sed 's/\// /g'
target: README.md
```> `` is used because the first command is **pwd**
### Complete example
It will look for **two occurences** of `` in the file `README.md` and inject the output of `pwd | sed 's/\// /g'` between these two occurences. If this action can't find them, it will **not** inject anything.
```yaml
uses: olivr-com/inject-command-action@v1
with:
command: pwd | sed 's/\// /g'
target: README.md
pattern:
force: false
```## Contribute
Checkout the v1 branch
Install the dependencies
```bash
npm install
```Run the tests
```bash
npm test
```### Package for distribution
GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.
Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.
Run package
```bash
npm run package
```Since the packaged index.js is run from the dist folder.
```bash
git add dist
```