From 090b5472c50b66dfc3779b17d5e9a92d21b4a1a6 Mon Sep 17 00:00:00 2001 From: elias-AD <88844419+elias-AD@users.noreply.github.com> Date: Wed, 27 Nov 2024 23:19:05 -0500 Subject: [PATCH] support_cloud_URLs Instead of relying only on *.atlassian.net, modify the input to be cloudUrl so different flavours of Confluence URLs can be used (including *.jira.com). --- README.md | 4 ++-- src/main.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4d5ec33..da13a22 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ jobs: Uses basic auth for the rest api. -- `cloud`: The ID can be found by looking at your confluence domain: `https://.atlassian.net/...` +- `cloudUrl`: The URL (without https://) of your confluence instance. E.g: `acme.atlassian.net/...` or `acme.jira.com` - `user`: The user that generated the access token - `token`: You can generate the token [here](https://id.atlassian.com/manage-profile/security/api-tokens). Link to [Docs](https://confluence.atlassian.com/cloud/api-tokens-938839638.html) -- `to`: The page ID can be found by simply navigating to the page where you want the content to be postet to and looke at the url. It will look something like this: `https://.atlassian.net/wiki/spaces//pages//` +- `to`: The page ID can be found by simply navigating to the page where you want the content to be postet to and looke at the url. It will look something like this: `https://<cloudUrl>/wiki/spaces/<space>/pages/<page-id>/<title>` ### Using secrets diff --git a/src/main.py b/src/main.py index 7e85f12..226c097 100644 --- a/src/main.py +++ b/src/main.py @@ -15,7 +15,7 @@ if not workspace: exit(1) envs: Dict[str, str] = {} -for key in ['from', 'to', 'cloud', 'user', 'token']: +for key in ['from', 'to', 'cloudUrl', 'user', 'token']: value = environ.get(f'INPUT_{key.upper()}') if not value: print(f'Missing value for {key}') @@ -25,7 +25,7 @@ for key in ['from', 'to', 'cloud', 'user', 'token']: with open(join(workspace, envs['from'])) as f: md = f.read() -url = f"https://{envs['cloud']}.atlassian.net/wiki/rest/api/content/{envs['to']}" +url = f"https://{envs['cloudUrl']}/wiki/rest/api/content/{envs['to']}" current = requests.get(url, auth=(envs['user'], envs['token'])).json()