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

[feature_request] 在 github actions 上加入 WARP 以处理 freenom 官网对 github ip 的访问限制 #196

Open
fscarmen opened this issue Jan 11, 2023 · 6 comments

Comments

@fscarmen
Copy link
Contributor

fscarmen commented Jan 11, 2023

#152

我新建了个项目,ac 上跑可以很简单的加上 WARP,以解除 freenom 对 github 的墙

      - name: Setup WARP
        uses: fscarmen/warp-on-actions@v2

以下是我的 ac 文件

######  说明  ######
# 1、Fork 本仓库
# 2、在你 Fork 的本仓库下的 Settings > Secrets 画面追加以下几个 secret 变量:
# FREENOM_USERNAME、FREENOM_PASSWORD、MULTIPLE_ACCOUNTS、MAIL_USERNAME、MAIL_PASSWORD、TO、MAIL_ENABLE、TELEGRAM_CHAT_ID、
# TELEGRAM_BOT_TOKEN、TELEGRAM_BOT_ENABLE、NOTICE_FREQ
# (注:此处列出了所有可用变量,你只用追加你需要用到的变量,变量的具体含义请参考本项目的 .env 文件中的说明,一般情况下,.env 文件中的某些
#  项存在默认值,如果默认值满足你的需求则可不追加到 Secrets,它们会保持默认)
#
# 下面定时任务中的时间是世界时间,每天 10:00 执行,由于创建虚拟环境会消耗时间,故任务会延迟 30 秒左右执行
#
# @Author of yml configuration file: RouRouX <https://github.com/RouRouX> & mybsdc <[email protected]>
#
######  end 说明  ######

name: Run it on action

on:
  workflow_dispatch:
  push:
    branches:
      - master
  schedule:
    - cron: 20 20 * * 3
jobs:
  run-it:
    runs-on: ubuntu-latest
    name: Run it on action
    steps:
      - name: Checkout master
        uses: actions/[email protected]
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '7.2'
      - name: Setting
        run: |
          echo 'Renew freenom domain name automatically.'
          echo '@Author of yml configuration file: RouRouX <https://github.com/RouRouX> & mybsdc <[email protected]>'
          echo '@Url: https://github.com/luolongfei/freenom'
          cp .env.example .env
          sudo mkdir -p logs/$(date +"%Y")-$(date +"%m")
          sudo chmod -Rf 777 logs
          if [[ ('${{ secrets.FREENOM_USERNAME }}' == '' || '${{ secrets.FREENOM_PASSWORD }}' == '') && '${{ secrets.MULTIPLE_ACCOUNTS }}' == '' ]]; then echo '你在 Github 的当前项目的 Settings > Secrets 画面没有设置任何与账户信息相关的 secret 值,无法正常运行,请添加新的 secret 值,设置 FREENOM_USERNAME 与 FREENOM_PASSWORD,或者设置 MULTIPLE_ACCOUNTS,以及 .env 文件中其它必要项,各项的具体含义与格式参考本项目 .env 文件中的说明。'; fi
          if [ '${{ secrets.FREENOM_USERNAME }}' != '' ]; then sed -i "s/^FREENOM_USERNAME=.*$/FREENOM_USERNAME='${{ secrets.FREENOM_USERNAME }}'/" .env; fi
          if [ '${{ secrets.FREENOM_PASSWORD }}' != '' ]; then sed -i "s/^FREENOM_PASSWORD=.*$/FREENOM_PASSWORD='${{ secrets.FREENOM_PASSWORD }}'/" .env; fi
          if [ '${{ secrets.MULTIPLE_ACCOUNTS }}' != '' ]; then sed -i "s/^MULTIPLE_ACCOUNTS=.*$/MULTIPLE_ACCOUNTS='${{ secrets.MULTIPLE_ACCOUNTS }}'/" .env; fi
          if [ '${{ secrets.MAIL_USERNAME }}' != '' ]; then sed -i "s/^MAIL_USERNAME=.*$/MAIL_USERNAME='${{ secrets.MAIL_USERNAME }}'/" .env; fi
          if [ '${{ secrets.MAIL_PASSWORD }}' != '' ]; then sed -i "s/^MAIL_PASSWORD=.*$/MAIL_PASSWORD='${{ secrets.MAIL_PASSWORD }}'/" .env; fi
          if [ '${{ secrets.TO }}' != '' ]; then sed -i "s/^TO=.*$/TO='${{ secrets.TO }}'/" .env; fi
          if [ '${{ secrets.MAIL_ENABLE }}' != '' ]; then sed -i "s/^MAIL_ENABLE=.*$/MAIL_ENABLE='${{ secrets.MAIL_ENABLE }}'/" .env; fi
          if [ '${{ secrets.TELEGRAM_CHAT_ID }}' != '' ]; then sed -i "s/^TELEGRAM_CHAT_ID=.*$/TELEGRAM_CHAT_ID='${{ secrets.TELEGRAM_CHAT_ID }}'/" .env; fi
          if [ '${{ secrets.TELEGRAM_BOT_TOKEN }}' != '' ]; then sed -i "s/^TELEGRAM_BOT_TOKEN=.*$/TELEGRAM_BOT_TOKEN='${{ secrets.TELEGRAM_BOT_TOKEN }}'/" .env; fi
          if [ '${{ secrets.TELEGRAM_BOT_ENABLE }}' != '' ]; then sed -i "s/^TELEGRAM_BOT_ENABLE=.*$/TELEGRAM_BOT_ENABLE='${{ secrets.TELEGRAM_BOT_ENABLE }}'/" .env; fi
          if [ '${{ secrets.NOTICE_FREQ }}' != '' ]; then sed -i "s/^NOTICE_FREQ=.*$/NOTICE_FREQ='${{ secrets.NOTICE_FREQ }}'/" .env; fi
          sed -i "s/^ON_GITHUB_ACTIONS=.*$/ON_GITHUB_ACTIONS=true/" .env
      - name: Setup WARP
        uses: fscarmen/warp-on-actions@v2
      - name: Run
        run: |
          php run
@lqinyli
Copy link

lqinyli commented Jan 26, 2023

Screenshot_20230126_125230
出錯了 大佬 怎麼解決

@mcxiaolan
Copy link

感谢大佬的 yml 文件,但有时候会报错误,但是 tg 收到了信息;
有时候执行时间会很长

Screenshot_2023-04-23-18-41-17-670_com android chrome
Screenshot_2023-04-23-18-41-35-515_com android chrome

@fscarmen
Copy link
Contributor Author

fscarmen commented Apr 23, 2023 via email

@mcxiaolan
Copy link

换成v2还是有这个情况? 岚天呀 @.>于2023年4月23日 周日18:43写道:

感谢大佬的 yml 文件,但有时候会报错误,但是 tg 收到了信息; 有时候执行时间会很长 [image: Screenshot_2023-04-23-18-41-17-670_com android chrome] https://user-images.githubusercontent.com/66471947/233835171-84327add-eb40-4363-884c-8daabb9acf64.jpg [image: Screenshot_2023-04-23-18-41-35-515_com android chrome] https://user-images.githubusercontent.com/66471947/233835174-1e5161e3-eb3b-4272-b36b-7b5ccd8b4452.jpg — Reply to this email directly, view it on GitHub <#196 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6MN3Z7KGJYHQVLIYRKEULXCUBUPANCNFSM6AAAAAATX3SBQY . You are receiving this because you authored the thread.Message ID: @.
>

不太懂怎么换v2🤣,如果执行错误或者他变成感叹号了,那 cron 定时任务还会继续下去吗

@fscarmen
Copy link
Contributor Author

image

@mcxiaolan
Copy link

mcxiaolan commented Apr 23, 2023

可以啦!
在您的代码的基础上,我在55行追加了一条

          if [ '${{ secrets.MOSAIC_SENSITIVE_INFO }}' != '' ]; then sed -i "s/^MOSAIC_SENSITIVE_INFO=.*$/MOSAIC_SENSITIVE_INFO='${{ secrets.MOSAIC_SENSITIVE_INFO }}'/" .env; fi

因为我是直接 fork 的,所以说别人也能看到一些邮箱信息

加了这个再在 Secrets 加一个
MOSAIC_SENSITIVE_INFO=1
这样就可以使邮箱部分变成*号了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants