From 6674e4d4215e14f27f5e5291c075feadd7870b20 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Wed, 22 Nov 2023 21:08:58 +0100 Subject: [PATCH] Doc sync improvements Escape PR titles using jq, add repo-owner (to avoid forks pushing docs) --- .github/workflows/update-docs.yml | 27 ++++++++++++------- examples/godot_tps_controller_port/Cargo.toml | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 1ad194f10..f45f906d9 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -39,6 +39,7 @@ jobs: { "op": "put", "repo": "gdnative", + "repo-owner": "${{ github.repository_owner }}", "num": "master", "commit-sha": "${{ github.sha }}", "date": "${{ github.event.head_commit.timestamp }}" @@ -52,18 +53,25 @@ jobs: # Opened/reopened/updated PR: include PR author + title - name: "Construct JSON (for PR sync)" if: github.event_name == 'pull_request' && github.event.action != 'closed' + # jq escapes backticks, double quotes etc. in PR title. run: | - payload=$(cat <<'HEREDOC' - { + payload=$(jq -n \ + --arg repoOwner '${{ github.repository_owner }}' \ + --arg num '${{ github.event.number }}' \ + --arg commitSha '${{ github.event.pull_request.head.sha }}' \ + --arg date '${{ github.event.pull_request.updated_at }}' \ + --arg prAuthor '${{ github.event.pull_request.user.login }}' \ + --arg prTitle '${{ github.event.pull_request.title }}' \ + '{ "op": "put", "repo": "gdnative", - "num": "${{ github.event.number }}", - "commit-sha": "${{ github.event.pull_request.head.sha }}", - "date": "${{ github.event.pull_request.updated_at }}", - "pr-author": "${{ github.event.pull_request.user.login }}", - "pr-title": "${{ github.event.pull_request.title }}" - } - HEREDOC) + "repo-owner": $repoOwner, + "num": $num, + "commit-sha": $commitSha, + "date": $date, + "pr-author": $prAuthor, + "pr-title": $prTitle + }') echo "VAR=$payload" echo "GDNATIVE_JSON<> $GITHUB_ENV echo "${payload}" >> $GITHUB_ENV @@ -77,6 +85,7 @@ jobs: { "op": "delete", "repo": "gdnative", + "repo-owner": "${{ github.repository_owner }}", "num": "${{ github.event.number }}", "date": "${{ github.event.pull_request.updated_at }}" } diff --git a/examples/godot_tps_controller_port/Cargo.toml b/examples/godot_tps_controller_port/Cargo.toml index f250adb40..671895c81 100644 --- a/examples/godot_tps_controller_port/Cargo.toml +++ b/examples/godot_tps_controller_port/Cargo.toml @@ -8,7 +8,7 @@ rust-version = "1.67" license = "MIT" [dependencies] -gdnative = { path = "../../gdnative" , features = ["formatted"] } +gdnative = { path = "../../gdnative", features = ["formatted"] } [lib] crate-type = ["cdylib"]