Automatically Run GitHub Action

I created a repo to automatically build firmware for my phicomm N1 using GitHub action. Workflows can be triggered manually with workflow_dispatch event, or triggered automatically with some events like push or pull request or scheduled events like triggering a workflow at a scheduled time.

However, I want to trigger my workflow when there are new commits on Lean’s OpenWrt source, which I use to build my firmware.

After a research, I find that GitHub has rss feed on commits, check here. Then a workflow can be triggered using rss and workflow_dispatch. There are some automate services like IFTTT and Integromat. I use Integromat because GitHub is deprecating API authentication through query parameters and authentication token should be sent in the header. Integromat free plan can do this perfectly. But there are 1000 limits for free plan. So I set my scenario to run on 12:01 AM UTC+8 every day to check if there are new commits on that OpenWrt branch and build new firmware if it has. Some tips:

  • Maximum number of returned items in RSS(Watch RSS feed items) should be set to 1 in case more than one workflows are triggered.
  • HTTP(Make a request) URL: https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow_file_name}/dispatches
  • HTTP(Make a request) Method: POST
  • HTTP(Make a request) Headers: {Authorization: token my_access_token}
  • HTTP(Make a request) Body type: Raw
  • HTTP(Make a request) Content type: JSON(application/json)
  • HTTP(Make a request) Request content: {“ref”: “main”}

Check my repo if you want to build OpenWrt for phicomm N1 as well.

blackgiulia
blackgiulia

放眼四野直至星穹,追溯时光直至永恒,需要思考的事情太多,每个生命的时间太少

comments powered by Disqus
Previous