diff --git a/.github/workflows/AllUp.yml b/.github/workflows/AllUp.yml
index 5e493b6..942182f 100644
--- a/.github/workflows/AllUp.yml
+++ b/.github/workflows/AllUp.yml
@@ -33,15 +33,10 @@ jobs:
- name: Main
run: python main.py
env:
+ BOT_PASSWORD: ${{ secrets.BOT_PASSWORD }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
- - uses: actions4git/setup-git@v1
- - run: |
- git checkout --orphan artifact/${{ github.ref }}
- git add AllUp.wikitext
- git commit -m "Update data"
- git push --force origin artifact/${{ github.ref }}
- name: Preview on Pull Request
if: ${{ github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v2.4.2
diff --git a/AllUp_utils/wiki.py b/AllUp_utils/wiki.py
index 2aff999..8b77fff 100644
--- a/AllUp_utils/wiki.py
+++ b/AllUp_utils/wiki.py
@@ -29,7 +29,12 @@ def pull(title : str,split_line = False):
except:
print(f'You do not have permission to get password.\nREF: {environ["GITHUB_REF"]}\nREPO_OWNER: {environ["GITHUB_REPOSITORY_OWNER"]}')
-def push(title : str,content_id : str,content : str):
- open(f'{title}.wikitext', 'w').write(content)
- if PR_TEST():
- print(f'### {content_id}\n\n```go\n{content}\n```\n\n',file = open('PR_preview.md','a'))
+def push(content : str):
+ if MAIN_REPO_BRANCH() or PR_TEST():
+ try:
+ wiki = Wiki('sat.huijiwiki.com', '雨伞CKY', environ['BOT_PASSWORD'])
+ wiki.edit('模板:AllUp',content,'Edit via AllUp-Satwiki')
+ except:
+ open(f'{title}.wikitext', 'w').write(content)
+ elif PR_TEST():
+ print(f'```go\n{content}\n```\n\n',file = open('PR_preview.md','a'))
diff --git a/PR_preview.md b/PR_preview.md
index 4d968c3..0f177ef 100644
--- a/PR_preview.md
+++ b/PR_preview.md
@@ -1,4 +1,4 @@
## Preview
-After _current_ modification of the PR, the program builds the main and TSS content as shown below. The content won't be uploaded to Satwiki before the PR is merged.
+After _current_ modification of the PR, the program builds the content as shown below. The content won't be uploaded to Satwiki before the PR is merged.
diff --git a/main.py b/main.py
index c0176f6..de2ccf0 100644
--- a/main.py
+++ b/main.py
@@ -136,4 +136,4 @@ def make(id):
for dataset in ['t'] + [str(i + 1) for i in range(4)] + ['#default']:
AllUp_data[dataset] = make(dataset)
AllUp_content = f'{AllUp_utils.wikitext.build_switch(AllUp_data)}[[Category:模板]]{{{{documentation}}}}'
- AllUp_utils.wiki.push('AllUp','MAIN',AllUp_content)
+ AllUp_utils.wiki.push(AllUp_content)