From 75f9bf995b08be2e9e761ba101c7dcfd453e5660 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Mon, 13 Apr 2026 16:11:23 +0400 Subject: [PATCH] fix: ensure pg-client cache dir is writable before restore actions/cache runs tar as the runner user, but /usr/lib/postgresql/ is root-owned, causing Permission denied errors on cache restore. Pre-create the directory with correct ownership, and re-chown after apt-get install so future cache saves work correctly. Co-Authored-By: Claude Opus 4.6 (1M context) --- action.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/action.yaml b/action.yaml index 26d7c7f..73b7769 100644 --- a/action.yaml +++ b/action.yaml @@ -57,6 +57,12 @@ runs: sudo make install # Use sudo to install globally cd ${{ github.action_path }} # Return to action directory + - name: Prepare postgresql client directory + shell: bash + run: | + sudo mkdir -p /usr/lib/postgresql/${{ inputs.postgres-version }} + sudo chown -R $(whoami) /usr/lib/postgresql/${{ inputs.postgres-version }} + - name: Cache postgresql-client uses: actions/cache@v4 id: pg-client-cache @@ -73,6 +79,7 @@ runs: echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list sudo apt-get update sudo apt-get install -y postgresql-client-${{ inputs.postgres-version }} + sudo chown -R $(whoami) /usr/lib/postgresql/${{ inputs.postgres-version }} - name: Start PostgreSQL shell: bash