Skip to content

Commit

Permalink
Update dynamic README workflow to open a Pull Request (#31)
Browse files Browse the repository at this point in the history
* Update dynamic render workflow

Some repositories have a protected branch rule. That means
our workflow won't work because commiting directly to main
is not allowed. To prevent that, the workflow will now
open a PR for the changes.

* Update workflow example

We only want to run this workflow if the README has changed, not
on every change.

* Removing leading / from snippet

As @nickcharlton pointed out,

> the leading / implies to me the start of a filesystem,
which it presumably isn't.

I tested removing it and it worked, so it was probably
needed when I was testing things but it's not needed anymore.

* Use latest workflow version
  • Loading branch information
Stefanni Brasil authored Apr 10, 2024
1 parent 47166e2 commit 24622fa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/dynamic-readme-example.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: update-templates

on:
on:
push:
paths:
- README.md
branches:
- main
workflow_dispatch:
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/dynamic-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ jobs:
README.md
committer_name: github-actions[bot]
committer_email: github-actions[bot]@users.noreply.github.com
commit_message: 'docs: update readme file with markdown templates [skip ci]'
commit_message: "docs: update readme file with markdown templates [skip ci]"
confirm_and_push: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: documentation files updated [skip ci]"
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
signoff: false
branch: github-actions/repository-maintenance
delete-branch: true
title: "Automatically Generated: Update Dynamic Section in README"
body: |
This PR was automatically generated to update the dynamic section in the README file.
Whenever the README is updated, this workflow is triggered to dynamically render the snippet
used in the README.
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,5 @@ under the terms specified in the [LICENSE] file.

[LICENSE]: /LICENSE

<!-- START /templates/footer.md -->
## About thoughtbot

![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)

This repo is maintained and funded by thoughtbot, inc.
The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software!
See [our other projects][community].
We are [available for hire][hire].

[community]: https://thoughtbot.com/community?utm_source=github
[hire]: https://thoughtbot.com/hire-us?utm_source=github

<!-- END /templates/footer.md -->
<!-- START templates/footer.md -->
<!-- END templates/footer.md -->

0 comments on commit 24622fa

Please sign in to comment.