diff --git a/.github/workflows/main.user.js_version_update.yaml b/.github/workflows/main.user.js_version_update.yaml index efd3ebc70..736bd5395 100644 --- a/.github/workflows/main.user.js_version_update.yaml +++ b/.github/workflows/main.user.js_version_update.yaml @@ -33,16 +33,12 @@ jobs: run: | sed -i "s/@version\s*[^\\s]*/@version $(TZ='Asia/Shanghai' date +'%Y-%m-%d')/" main.user.js - - name: Commit file main.user.js + - name: Commit and push main.user.js if: ${{ env.AHEAD == 'true' }} run: | - git config --local user.name "github-actions[bot]" - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add main.user.js - git commit -m "main.user.js Update to version $(TZ='Asia/Shanghai' date +'%Y-%m-%d')" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.CI_GITHUB_TOKEN }} - branch: ${{ github.ref }} + bash script/ci.sh \ + ${{ secrets.CI_GITHUB_TOKEN }} \ + "maboloshi/github-chinese" \ + "main.user.js" \ + "main.user.js Update to version $(TZ='Asia/Shanghai' date +'%Y-%m-%d')" + "Signed-off-by: 沙漠之子 <7850715+maboloshi@users.noreply.github.com>" diff --git a/script/ci_commit_with_signature.sh b/script/ci_commit_with_signature.sh new file mode 100644 index 000000000..703e9c631 --- /dev/null +++ b/script/ci_commit_with_signature.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +TOKEN=$1 +repoNwo=$2 +branch=$(git rev-parse --abbrev-ref HEAD) # 或 git rev-parse HEAD +file_path=$3 +encoded_file_content=$(base64 < "$file_path") +message_headline=$4 +message_body=$5 +expectedHeadOid=$(git rev-parse HEAD) + +curl $GITHUB_GRAPHQL_URL --silent \ + --write-out '%{stderr}HTTP status: %{response_code}\n\n' \ + -H "Authorization: bearer $TOKEN" \ + --data @- <