Skip to content

Commit

Permalink
git pfix: use actions/checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
idubnori committed Apr 2, 2024
1 parent 0ab449a commit 2174e7e
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ runs:
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requests module
- name: Install modules
shell: bash
run: pip install requests toml
run: pip install toml
- uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.wiki
sparse-checkout: |
${{ inputs.page-name }}
sparse-checkout-cone-mode: false
path: wiki_temp
- name: Load configuraions and set to environment
shell: python
run: |
import os
import requests
import toml
import json
Expand All @@ -31,20 +37,17 @@ runs:
def get_conf():
try:
# Get Wiki page
wiki_url = f"https://raw.githubusercontent.com/wiki/{repository_name}/${{ inputs.page-name }}"
#headers = {'Authorization': f'token ${{ github.token }}'}
response = requests.get(wiki_url) #TODO , headers=headers)
response.raise_for_status()
# Analyze TOML content
toml_content = response.text
start = toml_content.find("```") + 3
end = toml_content.rfind("```")
toml_content = toml_content[start:end]
parsed_toml = toml.loads(toml_content)
return parsed_toml
# Load Config file
with open("wiki_temp/${{ inputs.page-name }}", encoding="UTF-8") as f:
toml_content = f.read()
# Parse TOML content
start = toml_content.find("```") + 3
end = toml_content.rfind("```")
toml_content = toml_content[start:end]
parsed_toml = toml.loads(toml_content)
return parsed_toml
except Exception as e:
print(f"Error: {e}")
Expand Down

0 comments on commit 2174e7e

Please sign in to comment.