简体   繁体   中英

Update/Edit of workflow file in GitHub action

I have configured a manual workflow and it runs OK, but once I update/edit it and commit it to the same branch, the changes do not affect it. I mean the action still runs but uses the old version of the workflow file. is there any step I need to do?

Steps I followed for editing the workflow file: https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#browsing-marketplace-actions-in-the-workflow-editor

Here is workflow file details, just in case

The original:

# 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

Note: Let's say I just replace the last line with the bellow line, but my output still says Hello, world Nikzad,, 3 where it should say Hello, world Nikzad,, 4 .

run: echo Hello, world Nikzad!, 4

I found my problem. actually, when we are creating a new release, we are providing a tag name for that release, and when we create that tag name and push it to the repo, the version of the workflow at that point is what matters, so when I want to edit or update my workflow, I do the followings:

  1. Edit the workflow (Make any change you want, eg change the title or add echo)
  2. Commit and push workflow changes
  3. Create a new tag and push
  4. From the GitHub panel, create a new release based on the new tag
  5. Now I see the action is running based on the new workflow

Note: Maybe it is more about learning of the process, but I did not find it straight forward anywhere, I hope it helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM