Fix duplicated URL in OrganizationVariable.edit() and OrganizationSecret.edit() (#3472)
## Summary
- **Fix `OrganizationVariable.edit()`**: The `edit()` method constructed
the PATCH URL as `f"{self.url}/actions/variables/{self.name}"`, but
`self.url` already contains the full path (e.g.,
`/orgs/{org}/actions/variables/{name}`). This caused the URL to be
doubled to
`/orgs/{org}/actions/variables/{name}/actions/variables/{name}`,
resulting in a 404 error on every call.
- **Fix `OrganizationSecret.edit()`**: Same issue — the method used
`f"{self.url}/{secret_type}/secrets/{self.name}"` but `self.url` already
includes the full path, causing a doubled URL like
`/orgs/{org}/actions/secrets/{name}/actions/secrets/{name}`.
- **Fix `Organization.create_variable()`**: The returned
`OrganizationVariable` object had its `url` attribute set to the
organization URL (`self.url`, e.g., `/orgs/{org}`) instead of the full
variable URL (`/orgs/{org}/actions/variables/{name}`).
All three fixes align with how the parent `Variable.edit()` and
`Secret.delete()` methods already use `self.url` directly.
Fixes #3266
Fixes #3286
## Test plan
- [x] Added `testEditVariable` — verifies `OrganizationVariable.edit()`
sends PATCH to the correct URL (`/orgs/{org}/actions/variables/{name}`)
- [x] Added `testEditSecret` — verifies `OrganizationSecret.edit()`
sends PATCH to the correct URL (`/orgs/{org}/actions/secrets/{name}`)
- [x] Added `testCreateVariableUrl` — verifies
`Organization.create_variable()` returns a variable with the correct
full URL
- [x] All 86 existing Organization tests continue to pass
---------
Co-authored-by: Enrico Minack <github@enrico.minack.dev> K
Krishna Chaitanya committed
a2e76eb8ed2e2086aa62c2a769f450d9a00e66e7
Parent: 546b0ee
Committed by GitHub <noreply@github.com>
on 4/24/2026, 1:43:53 PM