From b6be6e089e2ad2b890716020edc52a4abd02e687 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Thu, 22 Aug 2024 13:43:02 +0200 Subject: [PATCH 1/3] Add Github action that automatically updates the README for PRs --- .github/workflows/readme_pr.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/readme_pr.yml diff --git a/.github/workflows/readme_pr.yml b/.github/workflows/readme_pr.yml new file mode 100644 index 00000000..5288f923 --- /dev/null +++ b/.github/workflows/readme_pr.yml @@ -0,0 +1,30 @@ +name: Update README for pull requests +on: + pull_request_target: + branches: + - master + types: + - opened + - ready_for_review + +jobs: + update-readme: + name: Re-generate README + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.MACHINE_USER_TOKEN }} + - uses: actions/setup-node@v4 + with: + node-version: 18 + - run: gh pr checkout ${{ github.event.pull_request.number }} + - run: yarn + - run: yarn compile + - run: yarn generate:readme + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore: re-generate README" + file_pattern: README.md From c63aea0f04521b48a5df2d143462623d0b488dd6 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Thu, 22 Aug 2024 13:44:57 +0200 Subject: [PATCH 2/3] Set missing GH_TOKEN environment variable --- .github/workflows/readme_pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/readme_pr.yml b/.github/workflows/readme_pr.yml index 5288f923..1d382222 100644 --- a/.github/workflows/readme_pr.yml +++ b/.github/workflows/readme_pr.yml @@ -21,6 +21,8 @@ jobs: with: node-version: 18 - run: gh pr checkout ${{ github.event.pull_request.number }} + env: + GH_TOKEN: ${{ github.token }} - run: yarn - run: yarn compile - run: yarn generate:readme From a8aa05b3324750045157d250715b9ddc833afafd Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Thu, 22 Aug 2024 13:46:37 +0200 Subject: [PATCH 3/3] Also re-generate README when new commits are added to a PR --- .github/workflows/readme_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/readme_pr.yml b/.github/workflows/readme_pr.yml index 1d382222..8156d195 100644 --- a/.github/workflows/readme_pr.yml +++ b/.github/workflows/readme_pr.yml @@ -6,6 +6,7 @@ on: types: - opened - ready_for_review + - synchronize jobs: update-readme: