Skip to content

Commit

Permalink
Merge pull request #14 from CIFriends/dev
Browse files Browse the repository at this point in the history
release: v1.0.0
  • Loading branch information
brenoepics authored May 25, 2024
2 parents 1461b15 + 87c3889 commit 734354a
Show file tree
Hide file tree
Showing 11 changed files with 5,036 additions and 151 deletions.
83 changes: 72 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<img src="https://raw.githubusercontent.com/CIFriends/brandkit/main/no-bg/cifriends.svg" alt="Logo" width="200px">
</a>

# prp-preprocessor
_A versatile GitHub Action that enables variable replacement in files using a simple_ `{_ variable _}` _syntax._
# prp-preprocessor

_A versatile GitHub Action that enables variable replacement in files using a simple_ `{_ variable _}` _syntax._

![Release](https://img.shields.io/github/v/release/CIFriends/prp-preprocessor?include_prereleases&sort=semver&logo=github)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/cifriends/prp-preprocessor/ci.yml?logo=github)
Expand All @@ -19,33 +19,94 @@
>
> Read our [docs](https://github.com/CIFriends/prp-preprocessor/wiki)
Are you tired of updating things like README version references, documentation, configuration files, and more on every
release?

_PRP automates this for you!
With PRP, you can focus on your code while it takes care of the tedious updates._

## Installation

> [!TIP]
> [How to Use](https://github.com/CIFriends/prp-preprocessor/wiki/How-to-Use)
> Reference: [How to Use](https://github.com/CIFriends/prp-preprocessor/wiki/How-to-Use)
To install the PRP Preprocessor, you can add it as a step in your [GitHub Actions](https://github.com/features/actions) workflow.
To install the PRP Preprocessor, you can add it as a step in your [GitHub Actions](https://github.com/features/actions)
workflow.
Here's an example of how to
use it:

```yml
steps:
- name: Checkout # Checkout the repository
uses: actions/checkout@v4
# with:
# ref: "main" # uncomment this line to check out a specific branch
- name: PRP Preprocessor
uses: CIFriends/prp-preprocessor@0.1.1
with:
rootDir: './example'
uses: CIFriends/prp-preprocessor@dev
env:
exampleVar: "Hello, World! This is an example variable."
```
<details>
<summary>Workflow Diagram</summary>
```mermaid
graph LR
A[GitHub Workflow] --> B[Checkout Action]
B --> C[PRP Preprocessor Action]
C --> D{Files with .prp extension?}
D -->|Yes| E[Process Files]
E --> F[Replace Variables]
F --> G[Commit Changes]
D -->|No| H[End Workflow]
G --> I[Push Changes]
I --> J[End Workflow]
```

</details>

## Usage

After installing the PRP Preprocessor, you can use it to replace variables in your `.prp.<any>` files.
Here's an example of how to
use it:

<details>
<summary>Using a variable in a file</summary>

`example.prp.json`

```json
{
"name": "{_ exampleVar _}"
}
```

Output:

`example.json`

```json
{
"name": "Hello, World! This is an example variable."
}
```

</details>

## Inputs

Inputs can be found at [here](https://github.com/CIFriends/prp-preprocessor/wiki/Inputs).
You can find the list of inputs and their descriptions in the [action.yml](action.yml) file,
or you can read the [docs](https://github.com/CIFriends/prp-preprocessor/wiki/Inputs).

## Contributing

We welcome contributions to this project! Please read our [Contributing Guide](CONTRIBUTING.md) for more information on how to contribute.
We welcome contributions to this project! Please read our [Contributing Guide](CONTRIBUTING.md) for more information on
how to contribute.

If you've found this project useful, please consider giving it a ⭐ on GitHub. This helps to spread the awareness of the project and is a great way to show your support!
If you've found this project useful, please consider giving it a ⭐ on GitHub.
This helps to spread the awareness of the
project and is a great way to show your support!

## License

Expand Down
81 changes: 71 additions & 10 deletions README.prp.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<img src="https://raw.githubusercontent.com/CIFriends/brandkit/main/no-bg/cifriends.svg" alt="Logo" width="200px">
</a>

# {_ prpTitle _}
_A versatile GitHub Action that enables variable replacement in files using a simple_ `{_ variable _}` _syntax._
# {_ prpTitle _}

_A versatile GitHub Action that enables variable replacement in files using a simple_ `{_ variable _}` _syntax._

![Release](https://img.shields.io/github/v/release/CIFriends/prp-preprocessor?include_prereleases&sort=semver&logo=github)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/cifriends/prp-preprocessor/ci.yml?logo=github)
Expand All @@ -18,33 +18,94 @@
>
> Read our [docs](https://github.com/CIFriends/prp-preprocessor/wiki)
Are you tired of updating things like README version references, documentation, configuration files, and more on every
release?

_PRP automates this for you!
With PRP, you can focus on your code while it takes care of the tedious updates._

## Installation

> [!TIP]
> [How to Use](https://github.com/CIFriends/prp-preprocessor/wiki/How-to-Use)
> Reference: [How to Use](https://github.com/CIFriends/prp-preprocessor/wiki/How-to-Use)
To install the PRP Preprocessor, you can add it as a step in your [GitHub Actions](https://github.com/features/actions) workflow.
To install the PRP Preprocessor, you can add it as a step in your [GitHub Actions](https://github.com/features/actions)
workflow.
Here's an example of how to
use it:

```yml
steps:
- name: Checkout # Checkout the repository
uses: actions/checkout@v4
# with:
# ref: "main" # uncomment this line to check out a specific branch
- name: PRP Preprocessor
uses: CIFriends/prp-preprocessor@{_currentVersion_}
with:
rootDir: './example'
env:
exampleVar: "Hello, World! This is an example variable."
```
<details>
<summary>Workflow Diagram</summary>
```mermaid
graph LR
A[GitHub Workflow] --> B[Checkout Action]
B --> C[PRP Preprocessor Action]
C --> D{Files with .prp extension?}
D -->|Yes| E[Process Files]
E --> F[Replace Variables]
F --> G[Commit Changes]
D -->|No| H[End Workflow]
G --> I[Push Changes]
I --> J[End Workflow]
```

</details>

## Usage

After installing the PRP Preprocessor, you can use it to replace variables in your `.prp.<any>` files.
Here's an example of how to
use it:

<details>
<summary>Using a variable in a file</summary>

`example.prp.json`

```json
{
"name": "{_ exampleVar _}"
}
```

Output:

`example.json`

```json
{
"name": "Hello, World! This is an example variable."
}
```

</details>

## Inputs

Inputs can be found at [here](https://github.com/CIFriends/prp-preprocessor/wiki/Inputs).
You can find the list of inputs and their descriptions in the [action.yml](action.yml) file,
or you can read the [docs](https://github.com/CIFriends/prp-preprocessor/wiki/Inputs).

## Contributing

We welcome contributions to this project! Please read our [Contributing Guide](CONTRIBUTING.md) for more information on how to contribute.
We welcome contributions to this project! Please read our [Contributing Guide](CONTRIBUTING.md) for more information on
how to contribute.

If you've found this project useful, please consider giving it a ⭐ on GitHub. This helps to spread the awareness of the project and is a great way to show your support!
If you've found this project useful, please consider giving it a ⭐ on GitHub.
This helps to spread the awareness of the
project and is a great way to show your support!

## License

Expand Down
1 change: 1 addition & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const inputParams: InputParams = {
ignoredDir: [],
ignoredVars: [],
includeSubDir: true,
includeAuthor: true,
encodings: "utf8"
};

Expand Down
1 change: 1 addition & 0 deletions __tests__/utils/VariablesManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe("VariableManager", () => {
ignoredVars: ["VAR1", "VAR2"],
ignoredDir: [...ignoredDefault],
envVars: new Map<string, string>(),
includeAuthor: true,
includeSubDir: true,
encodings: "utf8"
};
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ inputs:
description: "Encoding of the files"
required: true
default: "utf8"

ignoredVars:
description: "Ignore these variables"
required: false
default: ""
includeAuthor:
description: "Include workflow co-author in prp commit"
required: false
default: "true"
ignoredDirs:
description: "Ignore these directories"
required: false
Expand All @@ -40,7 +45,6 @@ inputs:
description: "Include subdirectories"
required: false
default: "true"

runs:
using: "node20"
main: "dist/index.js"
Loading

0 comments on commit 734354a

Please sign in to comment.