From 24622fac2961ffdf3812ea36ffff3cb7530b7d80 Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Wed, 10 Apr 2024 11:22:00 -0600 Subject: [PATCH] Update dynamic README workflow to open a Pull Request (#31) * 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 --- .github/workflows/dynamic-readme-example.yaml | 4 +++- .github/workflows/dynamic-readme.yaml | 20 ++++++++++++++++++- README.md | 18 ++--------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dynamic-readme-example.yaml b/.github/workflows/dynamic-readme-example.yaml index 41bb5db..b962ceb 100644 --- a/.github/workflows/dynamic-readme-example.yaml +++ b/.github/workflows/dynamic-readme-example.yaml @@ -1,7 +1,9 @@ name: update-templates -on: +on: push: + paths: + - README.md branches: - main workflow_dispatch: diff --git a/.github/workflows/dynamic-readme.yaml b/.github/workflows/dynamic-readme.yaml index 40c8759..ed4b7fd 100644 --- a/.github/workflows/dynamic-readme.yaml +++ b/.github/workflows/dynamic-readme.yaml @@ -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] + author: github-actions[bot] + 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. diff --git a/README.md b/README.md index 0f868a8..56ecd40 100644 --- a/README.md +++ b/README.md @@ -37,19 +37,5 @@ under the terms specified in the [LICENSE] file. [LICENSE]: /LICENSE - -## 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 - - + +