Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure DNS #85

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/AllUp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,10 @@ jobs:
- name: Main
run: python main.py
env:
BOT_PASSWORD: ${{ secrets.BOT_PASSWORD }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Proper use of secrets for BOT_PASSWORD.

Good practice to use GitHub secrets for sensitive information. Ensure the secret is managed securely.

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/[email protected]
Expand Down
13 changes: 9 additions & 4 deletions AllUp_utils/wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
yusancky marked this conversation as resolved.
Show resolved Hide resolved
wiki.edit('模板:AllUp',content,'Edit via AllUp-Satwiki')
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use except Exception: rather than bare except: (do-not-use-bare-except)

Suggested change
except:
except Exception:

open(f'{title}.wikitext', 'w').write(content)
Comment on lines +32 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Potential undefined variable 'title' in the exception handling block.

The variable 'title' is used in the exception handling block but it's not defined within the scope of the new push function. Consider passing 'title' as an argument to the function or handling the exception differently.

elif PR_TEST():
print(f'```go\n{content}\n```\n\n',file = open('PR_preview.md','a'))
2 changes: 1 addition & 1 deletion PR_preview.md
Original file line number Diff line number Diff line change
@@ -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.

2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<includeonly>{AllUp_utils.wikitext.build_switch(AllUp_data)}</includeonly><noinclude>[[Category:模板]]{{{{documentation}}}}</noinclude>'
AllUp_utils.wiki.push('AllUp','MAIN',AllUp_content)
AllUp_utils.wiki.push(AllUp_content)
Loading