当前位置: 首页 > news >正文

嵌入式软件开发公司哪家好seo网站推广专员招聘

嵌入式软件开发公司哪家好,seo网站推广专员招聘,烟台本地自己独立商城网站,桂林网络公司有哪些Github Action Bot 开发教程 在使用 Github 时,你可能在一些著名的开源项目,例如 Kubernetes,Istio 中看到如下的一些评论: /lgtm /retest /area bug /assign xxxx ...等等,诸如此类的一些功能性评论。在这些评论出现…

Github Action Bot 开发教程

在使用 Github 时,你可能在一些著名的开源项目,例如 Kubernetes,Istio 中看到如下的一些评论:

/lgtm
/retest
/area bug
/assign @xxxx
...

等等,诸如此类的一些功能性评论。在这些评论出现时,往往会出现一个 Github-bot 给问题添加一些 label,将 issue 分配给指定的人等等。类似注入此类的动作都是通过 Github Action 完成的。在本篇文章中,我们将介绍如何开发一个 Github Action Bot。

功能调研

要实现的 Action 动作为在 PR 下面评论 /retest 触发 action,自动收集运行失败的工作流 job,并重新运行。我们借鉴已有的 Action:

  • https://github.com/envoyproxy/toolshed/tree/main/gh-actions/retest

envoy 的实现是通过 ts 结合 Github 的 Rest API 完成:

  • https://docs.github.com/en/rest/pages/pages?apiVersion=2022-11-28

实现

本项目使用 Go 语言编写,通过 Github API Golang 实现和 Github 交互,编写完成之后,发布到 Github Action Marketplace。

  • https://github.com/actions-go/toolkit
  • https://github.com/google/go-github

大致思路

  1. 根据传入的 pr url,获取 pr 的信息;
  2. 之后根据 comment id 获取 comment 内容,判断是否为 /retest 是,则收集失败的 job,再次运行;
  3. 判断 job rerun 是否成功,成功给 comment 加入 🚀 响应。(注意:这里的成功是指创建 rerun-job 成功,不是指 job 本身成功!
  4. 运行结束。

代码目录结构

│  .gitignore
│  action.yml					# action.yml 配置
│  Dockerfile					# 项目运行需要的 Dockerfile
│  go.mod
│  go.sum
│  LICENSE
│  main.go						# 入口 main.go 文件
│  README.md
│
├─.github
│  └─workflows
│          build-and-test.yml		
│          retest.yml
└─retest						# retest 逻辑实现retest.goretest_test.gotypes.go

Github Action 配置

创建 action.yml 配置文件:

name: "Github Pull Request Retest"
description: 'Re-run failed GitHub Workflow runs on PRs by commenting "/retest".'
author: "yuluo"
branding:color: blueicon: activity
inputs:token:description: >GitHub token used to create and remove comments. By default, this uses therepository token provided by GitHub Actions. You can customize the user byreplacing this token with a user token which has write-access to yourrepository. Note that the token will be accessible to all repositorycollaborators.default: ${{ github.token }}comment-id:description: >-ID of comment for responserequired: truetype: numberpr-url:description: >-URL to fetch PR informationrequired: trueruns:using: 'docker'image: 'Dockerfile'args:- ${{ inputs.token }}- ${{ inputs.comment-id }}- ${{ inputs.pr-url }}- ${{ inputs.args }}

此配置文件中主要参数如下:文档 https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions

作者,名字,描述等式必须的。inputs 参数描述如下:

inputs: # 参数的字典milliseconds: # change this # 参数名,required: true # 是否是必填description: "input description here" # 参数的说明default: "default value if applicable" # 默认值

注意:inputs 参数是需要在 .github/workflows/action-ci.yml 中配置的输入参数,如果不配置,获取到的输入是空值!

runs 参数:

runs:# 运行 action 的方式,envoy 通过 nodejs 运行using: 'docker'# 在项目中需要编写 Dockerfile,作为镜像入口,envoy 使用 ts 编写,所以入口为 main: index.jsimage: 'Dockerfile'# 运行时输入到 Docker container 内部的参数。args:- ${{ inputs.token }}- ${{ inputs.comment-id }}- ${{ inputs.pr-url }}- ${{ inputs.args }}

本次编写中主要用到的配置项为以上两个,更多的参数可以参考文档。

发布

Github Action Marketplace:https://github.com/marketplace/new

项目在编写完成之后,建立一个 github repo,将代码上传到仓库,之后点击上述地址,就会出现 actions 选择。发布需要创建版本,根据要求创建一个对应版本即可。在发布时会检测 action.yml 配置,在合法之后才会允许发布。

发布成功如下:

https://github.com/marketplace/actions/github-pull-request-retest
请添加图片描述

使用

之后在任意仓库的 .github/workflows/command.yml 中配置如下内容即可使用:

name: Retest Action on PR Commenton:issue_comment:types: [created]permissions:contents: readjobs:retest:name: Retestruns-on: ubuntu-22.04permissions:pull-requests: writeactions: writesteps:- uses: yuluo-yx/gh-retest@v1.0.0-RC1with:token: ${{ secrets.GITHUB_TOKEN }}comment-id: ${{ github.event.comment.id }}pr-url: ${{ github.event.issue.pull_request.url }}

在此仓库对应的 pr 下面输入 /retest ,观察仓库 Action 即可看到 job 自动 rerun。

项目地址:https://github.com/yuluo-yx/gh-retest.git,欢迎 star。🚀🚀

http://www.hkea.cn/news/843220/

相关文章:

  • 衢州网站推广最近发生的重大新闻
  • 网页设计的网站配色方案seo基础培训机构
  • 维护网站是什么工作淄博网站制作
  • 做电影下载网站成本淘宝关键词排名
  • 企业h5网站建设百度推广电话是多少
  • 中国保密在线网站培训系统软文怎么做
  • 山西住房城乡建设部网站整合网络营销是什么
  • 做美图网站有哪些东西吗个人博客seo
  • 南昌专业做网站公司竞价托管怎么做
  • 网站产品展示怎么做微信小程序建站
  • dw做网站的流程客户引流的最快方法是什么
  • 做网站app优惠活动的交换链接营销成功案例
  • 企业公示信息查询系统山西上海百度推广优化公司
  • 上海网站排名优化价格武汉百度快照优化排名
  • 做网站小程序如何做广告宣传与推广
  • 网站建设背景朝阳百度新闻网页
  • 专门做拼团的网站西安网站开发
  • 怎么看网站开发语言太原seo推广
  • 什么网站做宣传好新乡网站seo
  • 济南网站制作服务价格信息流优化师前景
  • 新手制作网站工具bt磁力猪
  • 怎么做网站系统深圳头条新闻
  • 北京网站设计公司新鸿儒seo公司的选上海百首网络
  • 百姓网二手拖拉机百度seo优化排名客服电话
  • 北京南站是丰台站吗seo优化什么意思
  • 外贸营销型建站关键词全网搜索工具
  • 有什么网站可以做扣扣头像腾讯企点app下载安装
  • 网站设计怎么做链接拉新推广怎么快速拉人
  • 怎么自己做礼品网站补肾壮阳吃什么药效果好
  • 网站用户建设的设计与实现网站推广营销运营方式