mirror of
https://github.com/cupcakearmy/confluence-markdown-sync.git
synced 2024-12-22 07:56:25 +00:00
load dotenv
This commit is contained in:
parent
b38b874a2c
commit
93af96cd42
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,7 +2,8 @@
|
|||||||
.venv
|
.venv
|
||||||
|
|
||||||
# Dev
|
# Dev
|
||||||
|
.env
|
||||||
.vscode
|
.vscode
|
||||||
Test.md
|
Test.md
|
||||||
.github/workflows
|
.github/workflows/dev.yaml
|
||||||
*.secrets
|
*.secrets
|
1
Pipfile
1
Pipfile
@ -7,6 +7,7 @@ name = "pypi"
|
|||||||
requests = "*"
|
requests = "*"
|
||||||
markdown = "*"
|
markdown = "*"
|
||||||
py-gfm = "*"
|
py-gfm = "*"
|
||||||
|
python-dotenv = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
autopep8 = "*"
|
autopep8 = "*"
|
||||||
|
16
Pipfile.lock
generated
16
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "4442e062cdcb79bcf19db000646acc4c8b3ee3b7bc17bcdc2177e19e315cc6b5"
|
"sha256": "d6b13a7d2799118601293cb0223043b384b6904d96f267f21ce4a596d59ac954"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -21,7 +21,7 @@
|
|||||||
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
||||||
"sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"
|
"sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_full_version >= '3.6.0'",
|
||||||
"version": "==2022.12.7"
|
"version": "==2022.12.7"
|
||||||
},
|
},
|
||||||
"charset-normalizer": {
|
"charset-normalizer": {
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
|
"sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
|
||||||
"sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
|
"sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_full_version >= '3.6.0'",
|
||||||
"version": "==2.1.1"
|
"version": "==2.1.1"
|
||||||
},
|
},
|
||||||
"idna": {
|
"idna": {
|
||||||
@ -56,6 +56,14 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==2.0.0"
|
"version": "==2.0.0"
|
||||||
},
|
},
|
||||||
|
"python-dotenv": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:1684eb44636dd462b66c3ee016599815514527ad99965de77f43e0944634a7e5",
|
||||||
|
"sha256:b77d08274639e3d34145dfa6c7008e66df0f04b7be7a75fd0d5292c191d79045"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.21.0"
|
||||||
|
},
|
||||||
"requests": {
|
"requests": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
|
"sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
|
||||||
@ -138,7 +146,7 @@
|
|||||||
"sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
|
"sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
|
||||||
"sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
|
"sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.7'",
|
"markers": "python_version < '3.11'",
|
||||||
"version": "==2.0.1"
|
"version": "==2.0.1"
|
||||||
},
|
},
|
||||||
"typing-extensions": {
|
"typing-extensions": {
|
||||||
|
@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: cupcakearmy/confluence-markdown-sync@v1.0.1
|
- uses: cupcakearmy/confluence-markdown-sync@v1
|
||||||
with:
|
with:
|
||||||
from: './README.md'
|
from: './README.md'
|
||||||
to: '123456' # The confluence page id where to write the output
|
to: '123456' # The confluence page id where to write the output
|
||||||
@ -27,8 +27,10 @@ jobs:
|
|||||||
|
|
||||||
Uses basic auth for the rest api.
|
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://<cloud>.atlassian.net/...`
|
||||||
|
|
||||||
- `user`: The user that generated the access token
|
- `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)
|
- `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://<cloud-id>.atlassian.net/wiki/spaces/<space>/pages/<page-id>/<title>`
|
- `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://<cloud-id>.atlassian.net/wiki/spaces/<space>/pages/<page-id>/<title>`
|
||||||
|
@ -3,18 +3,23 @@ from os.path import join
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from dotenv import load_dotenv
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
from mdx_gfm import GithubFlavoredMarkdownExtension
|
from mdx_gfm import GithubFlavoredMarkdownExtension
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
workspace = environ.get('GITHUB_WORKSPACE')
|
workspace = environ.get('GITHUB_WORKSPACE')
|
||||||
if not workspace:
|
if not workspace:
|
||||||
raise Exception('No workspace is set')
|
print('No workspace is set')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
envs: Dict[str, str] = {}
|
envs: Dict[str, str] = {}
|
||||||
for key in ['from', 'to', 'cloud', 'user', 'token']:
|
for key in ['from', 'to', 'cloud', 'user', 'token']:
|
||||||
value = environ.get(f'INPUT_{key.upper()}')
|
value = environ.get(f'INPUT_{key.upper()}')
|
||||||
if not value:
|
if not value:
|
||||||
raise Exception(f'Missing value for {key}')
|
print(f'Missing value for {key}')
|
||||||
|
exit(1)
|
||||||
envs[key] = value
|
envs[key] = value
|
||||||
|
|
||||||
with open(join(workspace, envs['from'])) as f:
|
with open(join(workspace, envs['from'])) as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user