diff --git a/.gitignore b/.gitignore index c6a8391..6df83e6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,8 @@ .venv # Dev +.env .vscode Test.md -.github/workflows -*.secrets \ No newline at end of file +.github/workflows/dev.yaml +*.secrets diff --git a/Pipfile b/Pipfile index 5ebc182..3d52af6 100644 --- a/Pipfile +++ b/Pipfile @@ -7,6 +7,7 @@ name = "pypi" requests = "*" markdown = "*" py-gfm = "*" +python-dotenv = "*" [dev-packages] autopep8 = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 2a2312b..22ecddd 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "4442e062cdcb79bcf19db000646acc4c8b3ee3b7bc17bcdc2177e19e315cc6b5" + "sha256": "d6b13a7d2799118601293cb0223043b384b6904d96f267f21ce4a596d59ac954" }, "pipfile-spec": 6, "requires": { @@ -21,7 +21,7 @@ "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3", "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==2022.12.7" }, "charset-normalizer": { @@ -29,7 +29,7 @@ "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845", "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==2.1.1" }, "idna": { @@ -56,6 +56,14 @@ "index": "pypi", "version": "==2.0.0" }, + "python-dotenv": { + "hashes": [ + "sha256:1684eb44636dd462b66c3ee016599815514527ad99965de77f43e0944634a7e5", + "sha256:b77d08274639e3d34145dfa6c7008e66df0f04b7be7a75fd0d5292c191d79045" + ], + "index": "pypi", + "version": "==0.21.0" + }, "requests": { "hashes": [ "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983", @@ -138,7 +146,7 @@ "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f" ], - "markers": "python_version >= '3.7'", + "markers": "python_version < '3.11'", "version": "==2.0.1" }, "typing-extensions": { diff --git a/README.md b/README.md index 4ffd097..940ae36 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: cupcakearmy/confluence-markdown-sync@v1.0.1 + - uses: cupcakearmy/confluence-markdown-sync@v1 with: from: './README.md' to: '123456' # The confluence page id where to write the output @@ -27,8 +27,10 @@ jobs: Uses basic auth for the rest api. -- `cloud`: The ID can be found by looking at yout confluence domain: `https://xxx.atlassian.net/...` +- `cloud`: The ID can be found by looking at your confluence domain: `https://.atlassian.net/...` + - `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//` diff --git a/src/main.py b/src/main.py index fb59e6c..7e85f12 100644 --- a/src/main.py +++ b/src/main.py @@ -3,18 +3,23 @@ from os.path import join from typing import Dict import requests +from dotenv import load_dotenv from markdown import markdown from mdx_gfm import GithubFlavoredMarkdownExtension +load_dotenv() + workspace = environ.get('GITHUB_WORKSPACE') if not workspace: - raise Exception('No workspace is set') + print('No workspace is set') + exit(1) envs: Dict[str, str] = {} for key in ['from', 'to', 'cloud', 'user', 'token']: value = environ.get(f'INPUT_{key.upper()}') if not value: - raise Exception(f'Missing value for {key}') + print(f'Missing value for {key}') + exit(1) envs[key] = value with open(join(workspace, envs['from'])) as f: