From e3b47524dd57c96abb68e2f4489dd592181f348b Mon Sep 17 00:00:00 2001 From: FajarKim Date: Sun, 12 Nov 2023 14:09:55 +0700 Subject: [PATCH] ci(workflows): fixed generate theme readme --- .github/workflows/generate-theme-doc.yml | 18 +++++++++++------- scripts/push-theme-readme.sh | 12 ++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 scripts/push-theme-readme.sh diff --git a/.github/workflows/generate-theme-doc.yml b/.github/workflows/generate-theme-doc.yml index 9720c93..bb38173 100644 --- a/.github/workflows/generate-theme-doc.yml +++ b/.github/workflows/generate-theme-doc.yml @@ -24,6 +24,10 @@ jobs: node-version: ${{ matrix.node-version }} cache: npm + # Fix the unsafe repo error which was introduced by the CVE-2022-24765 git patches. + - name: Fix unsafe repo error + run: git config --global --add safe.directory ${{ github.workspace }} + - name: npm install, generate readme run: | npm ci @@ -31,11 +35,11 @@ jobs: env: CI: true - - name: Commit Changes - uses: EndBug/add-and-commit@v7 + - name: Run Script + uses: skx/github-action-tester@e29768ff4ff67be9d1fdbccd8836ab83233bebb1 # v0.10.0 with: - author_name: GitHub Actions - author_email: github-actions[bot]@users.noreply.github.com - message: "docs(theme): Auto uptade theme readme" - add: "themes/README.md" - github_token: ${{ secrets.GITHUB_TOKEN }} + script: ./scripts/push-theme-readme.sh + env: + CI: true + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + GH_REPO: ${{ secrets.GH_REPO }} diff --git a/scripts/push-theme-readme.sh b/scripts/push-theme-readme.sh new file mode 100644 index 0000000..048a00b --- /dev/null +++ b/scripts/push-theme-readme.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -x +set -e + +git --version +git config --global user.email "github-actions[bot]@users.noreply.github.com" +git config --global user.name "GitHub Actions" +git config --global --add safe.directory ${GITHUB_WORKSPACE} +git add --all +git commit --no-verify --message "docs(theme): auto update theme readme" +git remote add master https://${PERSONAL_TOKEN}@github.com/${GH_REPO}.git +git push -f