😮‍💨完善github信息获取机制,完善action文件,修复问题(@weekdaycare)

This commit is contained in:
柳神 2024-10-29 12:01:38 +08:00
parent d9019fe88e
commit ec87edc284
4 changed files with 23 additions and 9 deletions

View File

@ -26,7 +26,7 @@ jobs:
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
body: | body: |
🤩你好呀! ${{ github.event.issue.user.login }}!你已经成功通过邮件订阅了本站啦!若有新文章将通过邮箱推送给你!谢谢你的订阅! 🤩你好呀! ${{ github.event.issue.user.login }}!你已经成功通过邮件订阅了本站啦!若有新文章将通过邮箱推送给你!谢谢你的订阅!
😥如果您实在想要关闭订阅在右下角直接删除这个issue就好咕咕咕咕咕咕咕 😥如果您实在想要关闭订阅在右下角直接删除这个issue就好咕咕咕咕咕咕咕感谢你的订阅!
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v3 uses: actions-cool/issues-helper@v3

View File

@ -46,7 +46,9 @@ jobs:
- name: Check RSS feeds - name: Check RSS feeds
env: env:
SMTP_PWD: ${{ secrets.SMTP_PWD }} SMTP_PWD: ${{ secrets.SMTP_PWD }}
FCL_REPO: ${{ github.repository }}
run: | run: |
echo "Checking RSS feeds..."
python run.py python run.py
- name: Upload last_articles.json as artifact - name: Upload last_articles.json as artifact

12
run.py
View File

@ -45,8 +45,20 @@ if config["email_push"]["enable"]:
if config["rss_subscribe"]["enable"]: if config["rss_subscribe"]["enable"]:
print("RSS通过issue订阅已启用") print("RSS通过issue订阅已启用")
# 获取并强制转换为字符串 # 获取并强制转换为字符串
# 尝试从环境变量获取 FCL_REPO
fcl_repo = os.getenv('FCL_REPO')
# 提取 github_username 和 github_repo
if fcl_repo:
github_username, github_repo = fcl_repo.split('/')
print(f"从环境变量获取到的 GitHub Username: {github_username}")
print(f"从环境变量获取到的 GitHub Repo: {github_repo}")
else:
github_username = str(config["rss_subscribe"]["github_username"]).strip() github_username = str(config["rss_subscribe"]["github_username"]).strip()
github_repo = str(config["rss_subscribe"]["github_repo"]).strip() github_repo = str(config["rss_subscribe"]["github_repo"]).strip()
print(f"从配置文件获取到的 GitHub Username: {github_username}")
print(f"从配置文件获取到的 GitHub Repo: {github_repo}")
your_blog_url = config["rss_subscribe"]["your_blog_url"] your_blog_url = config["rss_subscribe"]["your_blog_url"]
email_template = config["rss_subscribe"]["email_template"] email_template = config["rss_subscribe"]["email_template"]
# 获取网站信息 # 获取网站信息