Skip to content

Commit 034bc48

Browse files
committed
docs: Pull Request Support documentation added
1 parent e3eab84 commit 034bc48

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

README.md

+50-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To overcome this limitation, and help developers such as myself automate this te
2323
| `GLOBAL_TEMPLATE_REPOSITORY` | you can set a global repository template where all the files are stored. | `false`
2424
| `committer_name` | Specify the committer name | `Dynamic Readme` |
2525
| `committer_email` | Specify the committer email | `[email protected]` |
26-
| `commit_message` | set a custom commit message | `💬 - File Rebuilt | Github Action Runner : ${GITHUB_RUN_NUMBER}` |
26+
| `commit_message` | set a custom commit message | ` 💬 - File Rebuilt | Github Action Runner : ${GITHUB_RUN_NUMBER} ` |
2727
| `confirm_and_push` | Commit the changes and push directly to repository | `true` |
2828
<!-- END RAW_CONTENT -->
2929

@@ -147,6 +147,54 @@ Reusable Includes Custom Markdown :
147147
>
148148
> :information_source: Even though **Reusable includes** and **Inline Includes** do the same work, they can come in handy when you are generating a template and saving it in the same file. It preserves the include comment which will be parsed again when re-generating the template, and the contents of the include will be updated accordingly.
149149
150+
### Pull Request Support
151+
152+
This action modifies the files, creates a commit and uploads them directly to the default branch of the repository.
153+
154+
If the default branch of the repository is protected by the rule `Require a pull request before merging` then you will need to set the option `confirm_and_push: false` so that the commit is not made and the changes are not uploaded to the default branch.
155+
156+
``` yaml
157+
- name: "💫 Dynamic Template Render"
158+
uses: varunsridharan/action-dynamic-readme@main
159+
with:
160+
GLOBAL_TEMPLATE_REPOSITORY: {repository-owner}/{repository-name}
161+
files: |
162+
FILE.md
163+
FILE2.md=output_filename.md
164+
folder1/file.md=folder2/output.md
165+
confirm_and_push: false # Important if use "Require a pull request before merging" rule
166+
env:
167+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
```
169+
170+
In addition to the previous configuration, it is necessary to use other actions to be able to confirm the changes and generate a Pull Request towards the default branch
171+
172+
``` yaml
173+
- name: "📥 Fetching Repository Contents"
174+
uses: actions/checkout@main
175+
176+
- name: "💫 Dynamic Template Render"
177+
uses: varunsridharan/action-dynamic-readme@main
178+
with:
179+
GLOBAL_TEMPLATE_REPOSITORY: {repository-owner}/{repository-name}
180+
files: |
181+
FILE.md
182+
FILE2.md=output_filename.md
183+
folder1/file.md=folder2/output.md
184+
confirm_and_push: false # Important if use "Require a pull request before merging" rule
185+
env:
186+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
187+
188+
- name: Create pull request
189+
uses: peter-evans/create-pull-request@v3
190+
with:
191+
token: ${{ secrets.GITHUB_TOKEN }}
192+
```
193+
194+
Thanks to this configuration, the necessary files can be dynamically generated by adding them to a different branch that then we can merge with the default branch, complying with the rule `Require a pull request before merging`.
195+
196+
Check out the example workflow (Pull Request Support) for a more advanced configuration
197+
150198
---
151199

152200
<h3 align="center"> For live Demo Please Check <a href="https://github.com/varunsridharan/demo-dynamic-readme">Demo Repository</a> </h3>
@@ -191,7 +239,7 @@ jobs:
191239

192240
<!-- END RAW_CONTENT -->
193241

194-
## 🚀 Example Workflow File (Pull Request)
242+
## 🚀 Example Workflow File (Pull Request Support)
195243

196244
<!-- START RAW_CONTENT -->
197245
```yaml

0 commit comments

Comments
 (0)