for entrie in feed_entries[0: all_number]: title = entrie["title"] link = "http://dawnchannel.tech"+entrie["link"] result = result + "\n" + "[" + title + "](" + link + ")" + "\n" return result
def main(): insert_info = get_link_info("http://dawnchannel.tech/content.json", 6) # 替换 ---start--- 到 ---end--- 之间的内容 # pytz.timezone('Asia/Shanghai')).strftime('%Y年%m月%d日%H时M分') fmt = '%Y-%m-%d %H:%M:%S %Z%z' insert_info = "## Recent Blog Posts(" + "update time:"+ datetime.fromtimestamp(int(time.time()),pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S') +")\n" + insert_info + "\n\n<br/>\n\n## 💻:keyboard: Languages and Tools " # 获取README.md内容 print(insert_info) with open (os.path.join(os.getcwd(), "README.md"), 'r', encoding='utf-8') as f: readme_md_content = f.read() new_readme_md_content = re.sub(r'## Recent Blog Posts(.|\n)*## 💻:keyboard: Languages and Tools ', insert_info, readme_md_content) with open (os.path.join(os.getcwd(), "README.md"), 'w', encoding='utf-8') as f: f.write(new_readme_md_content) main()
jobs: stale: runs-on:ubuntu-latest strategy: matrix: # in this example, there is a newer version already installed, 3.7.7, so the older version will be downloaded python-version: ['3.7.4'] steps: -uses:actions/checkout@v2# Checking out the repo -name:Installdependecies uses:VaultVulp/action-pipenv@v2.0.1 with: command:install-d# Install all dependencies, including development ones -name:Build uses:VaultVulp/action-pipenv@v2.0.1 with: command:runbuild -name:Commitandpushifchanged# 更新README.md run:| git diff git config --global user.email "1183503933@qq.com" git config --global user.name "leonyan" git add README.md git commit -m "Github Action Auto Updated" git push