跳到主要内容

Github

Workflow与GithubAction

GithubWorkflow简述

Workflow可以简单的理解为开设一个**“临时”**使用的服务器,并在此服务器上运行指定的命令或脚本

Workflow配置

Workflow使用.yml进行配置,放在仓库根目录下的.github/Workflow文件夹中

具体配置文件可以在Github提供的模板文件的基础上进行修改

备注

若需要将要运行结果保存为文件,需要将代码提交到仓库

并需要授予权限

permissions: write-all

step:
- name: Commit and push changes to another branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions"
git config --global user.email "actions@github.com"
git add -A
git commit -m "Add generated files"
git push origin main

secrets是Github提供的一项功能,可以保存个人TOKEN等需要保密的部分并在运行时加入程序

Workflow触发器

Workflow可以设置为使用多种触发器,包括:

63fdd50d59aa