https://github.com/ivangabriele/find-and-replace-pull-request-body
Github Action replacing workflow related Pull Request body.
https://github.com/ivangabriele/find-and-replace-pull-request-body
Last synced: 7 months ago
JSON representation
Github Action replacing workflow related Pull Request body.
- Host: GitHub
- URL: https://github.com/ivangabriele/find-and-replace-pull-request-body
- Owner: ivangabriele
- License: mit
- Created: 2022-11-24T00:22:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T00:58:55.000Z (9 months ago)
- Last Synced: 2025-03-15T05:36:13.780Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 484 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# find-and-replace-pull-request-body
> This action replaces the workflow related action Pull Request body.
---
- [Usage](#usage)
- [Replacing the entire PR body (continuous)](#replacing-the-entire-pr-body-continuous)
- [Replacing a specific part of the PR body using a string (one time)](#replacing-a-specific-part-of-the-pr-body-using-a-string-one-time)
- [Replacing a specific part of the PR body using an HTML Comment Tag (continuous)](#replacing-a-specific-part-of-the-pr-body-using-an-html-comment-tag-continuous)
- [Running against different workflow triggers](#running-against-different-workflow-triggers)---
## Usage
### Replacing the entire PR body (continuous)
```yml
- name: Replace Pull Request Body
uses: ivangabriele/find-and-replace-pull-request-body@v1.1.5
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
body: |
# A New PR Body TitleWith a new body description.
```### Replacing a specific part of the PR body using a string (one time)
Let's say you have a PR body like this:
```md
# Preview URL_Waiting for deployment..._
``````yml
- name: Replace Pull Request Body
uses: ivangabriele/find-and-replace-pull-request-body@v1.1.5
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
find: '_Waiting for deployment..._'
replace: 'https://example.com/my-preview'
```will replace the `find` string with the `replace` string and update the PR body to become:
```md
# Preview URLhttps://example.com/my-preview
```### Replacing a specific part of the PR body using an HTML Comment Tag (continuous)
Let's say you have a PR body like this:
```md
# Preview URL_Waiting for deployment..._
```
```yml
- name: Replace Pull Request Body
uses: ivangabriele/find-and-replace-pull-request-body@v1.1.5
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
find: 'AUTOFILLED_PREVIEW_URL'
isHtmlCommentTag: true
replace: 'https://example.com/my-preview'
```will replace what's between the `find` HTML Comment Tags with the `replace` string and update the PR body to become:
```md
# Preview URLhttps://example.com/my-preview
```
### Running against different workflow triggers
If running the workflow in response to a `pull_request` event the action will update the associated pull request.
The action can be configured to update a manually specified pull request instead, by providing the `prNumber`. This way it can be ran in response to a `deployment_status` event, or a manual `workflow_dispatch` trigger.
```yml
- name: Replace Pull Request Body
uses: ivangabriele/find-and-replace-pull-request-body@v1.1.5
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
prNumber: ${{ inputs.pr }}
```