https://github.com/pkgjs/patch-my-code-of-conduct
A tool for creating a code of conduct with a prefix and a patch
https://github.com/pkgjs/patch-my-code-of-conduct
Last synced: 4 months ago
JSON representation
A tool for creating a code of conduct with a prefix and a patch
- Host: GitHub
- URL: https://github.com/pkgjs/patch-my-code-of-conduct
- Owner: pkgjs
- Created: 2022-11-11T21:58:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-21T08:01:32.000Z (over 1 year ago)
- Last Synced: 2025-11-17T18:25:51.264Z (8 months ago)
- Language: JavaScript
- Size: 274 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Patch my Code of Conduct
This action adds a prefix to the default Code of Conduct template and applies the necessary templates.
If used with `gr2m/create-or-update-pull-request-action@v1` workflow automatically creates a pull
request with the applied changes.
- Opens a pull request if output file does not exist [(Example)](https://github.com/anonrig/patch-test/pull/1)
- Opens a pull request if patch file is changed [(Example)](https://github.com/anonrig/patch-test/pull/7)
## Example Workflow
```yaml
on: [push]
jobs:
main_job:
runs-on: ubuntu-latest
name: Test Action
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Start Patch
uses: pkgjs/patch-my-code-of-conduct@v1.3.0
with:
base_url: './BASE.md'
patch_file_path: './patch'
output_file_path: './CODE_OF_CONDUCT.md'
- uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: "Applied the patch to the base Code of Conduct."
branch: actions/patch-code-of-conduct # Custom branch *just* for this Action.
commit-message: 'doc: update Code of Conduct'
title: 'doc: update Code of Conduct'
```
## Useful Information
### Generate patch file
- Generate a `premable+template.md`
- Generate a `original-expected.md` file
```bash
diff -Naur preamble+template.md original-expected.md > patch
```
### Running patching script
```
patch -i patch preamble+template.md -o expected.md --no-backup-if-mismatch
```