在GitHub动作中更新/编辑工作流文件



我已经配置了一个手动工作流,它运行正常,但是一旦我更新/编辑它并将其提交到同一分支,更改不会影响它。我的意思是操作仍然运行,但使用旧版本的工作流文件。我还需要做什么吗?

编辑工作流文件的步骤:https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions browsing-marketplace-actions-in-the-workflow-editor

这里是工作流文件的详细信息,以防万一

原:

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "development" branch
release:
types: [created]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world Nikzad!, 3

注意:假设我只是将最后一行替换为下面的行,但是我的输出仍然是Hello, world Nikzad!, 3,而应该是Hello, world Nikzad!, 4

run: echo Hello, world Nikzad!, 4

我找到我的问题了。实际上,当我们创建一个新版本时,我们会为该版本提供一个标签名称,当我们创建该标签名称并将其推送到repo时,此时的工作流版本是最重要的,所以当我想要编辑或更新我的工作流时,我做以下操作:

  1. 编辑工作流(做任何你想要的改变,例如改变标题或添加回声)
  2. 提交和推送工作流更改
  3. 创建新标签并推送
  4. 从GitHub面板中,基于新标签
  5. 创建一个新版本
  6. 现在我看到动作正在基于新的工作流
  7. 运行

注意:也许它更多的是关于学习的过程,但我没有找到它直接在任何地方,我希望它能帮助别人。

最新更新