Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 17 days 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 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-01T00:46:31.000Z (about 1 month ago)
- Last Synced: 2024-10-12T19:27:18.030Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 442 KB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 12
-
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
prNumber: ${{ inputs.pr }}
```