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

Nas*_*zad 1 workflow continuous-integration action 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
Run Code Online (Sandbox Code Playgroud)

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

run: echo Hello, world Nikzad!, 4
Run Code Online (Sandbox Code Playgroud)

Nas*_*zad 5

我发现了我的问题。实际上,当我们创建新版本时,我们正在为该版本提供一个标签名称,当我们创建该标签名称并将其推送到存储库时,此时工作流程的版本才是重要的,所以当我想要时要编辑或更新我的工作流程,我执行以下操作:

  1. 编辑工作流程(进行任何您想要的更改,例如更改标题或添加回显)
  2. 提交并推送工作流程更改
  3. 创建新标签并推送
  4. 从 GitHub 面板中,根据新标签创建新版本
  5. 现在我看到该操作正在根据新的工作流程运行

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