簡體   English   中英

在 GitHub 操作中更新/編輯工作流文件

[英]Update/Edit of workflow file in GitHub action

我已經配置了一個手動工作流並且它運行正常,但是一旦我更新/編輯它並將它提交到同一個分支,這些更改就不會影響它。 我的意思是該操作仍在運行,但使用的是舊版本的工作流文件。 有什么我需要做的步驟嗎?

我遵循的編輯工作流文件的步驟: 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

注意:假設我只是用下面的行替換了最后一行,但我的 output 仍然說Hello, world Nikzad,, 3應該說Hello, world Nikzad,, 4

run: echo Hello, world Nikzad!, 4

我發現了我的問題。 實際上,當我們創建一個新版本時,我們為該版本提供了一個標簽名稱,當我們創建該標簽名稱並將其推送到存儲庫時,此時工作流的版本很重要,所以當我想要要編輯或更新我的工作流程,我會執行以下操作:

  1. 編輯工作流程(進行任何您想要的更改,例如更改標題或添加回顯)
  2. 提交並推送工作流更改
  3. 創建一個新標簽並推送
  4. 從 GitHub 面板,根據新標簽創建新版本
  5. 現在我看到操作正在基於新的工作流程運行

注意:也許更多的是關於過程的學習,但我沒有在任何地方直接找到它,我希望它能幫助別人。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM