Skip to content

Stage exact role-name publication #1

Stage exact role-name publication

Stage exact role-name publication #1

name: Publish role name change
on:
push:
branches:
- fix/verbatim-worker-role-name
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create exact multi-file commit
env:
GH_TOKEN: ${{ github.token }}
BASE_SHA: acb9e51cf5111366f71a6b03e053625c7fd99c2b
TARGET_REF: heads/fix/verbatim-worker-role-name
shell: bash
run: |
cp .github/publication/role-name.patch /tmp/role-name.patch
git checkout --detach "$BASE_SHA"
git apply --index /tmp/role-name.patch
paths=(
CHANGELOG.md
src/types.rs
tests/e2e/sql/17_superuser_guc.sql
tests/e2e/sql/49_quoted_role_names.sql
)
base_tree=$(gh api "repos/$GITHUB_REPOSITORY/git/commits/$BASE_SHA" --jq .tree.sha)
tree_entries='[]'
for path in "${paths[@]}"; do
blob_sha=$(jq -n --rawfile content "$path" '{content:$content,encoding:"utf-8"}' | gh api --method POST "repos/$GITHUB_REPOSITORY/git/blobs" --input - --jq .sha)
tree_entries=$(jq -c --arg path "$path" --arg sha "$blob_sha" '. + [{path:$path,mode:"100644",type:"blob",sha:$sha}]' <<< "$tree_entries")
done
tree_sha=$(jq -n --arg base_tree "$base_tree" --argjson tree "$tree_entries" '{base_tree:$base_tree,tree:$tree}' | gh api --method POST "repos/$GITHUB_REPOSITORY/git/trees" --input - --jq .sha)
message=$'Use raw role names verbatim for worker connections\n\nPass exact catalog role names unchanged to workflow connection options so role checks and authentication use the same identity. Remove identifier reinterpretation and add regression coverage for literal quote-wrapped role names.'
commit_sha=$(jq -n --arg message "$message" --arg tree "$tree_sha" --arg parent "$BASE_SHA" '{message:$message,tree:$tree,parents:[$parent]}' | gh api --method POST "repos/$GITHUB_REPOSITORY/git/commits" --input - --jq .sha)
gh api --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/$TARGET_REF" -f sha="$commit_sha" -F force=true