首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git操作将工作流触发器保存到变量

git操作将工作流触发器保存到变量
EN

Stack Overflow用户
提问于 2021-07-06 19:08:12
回答 1查看 72关注 0票数 0

我写了一个Github操作工作流,只有当一些特定的文件更新时才会触发:

代码语言:javascript
复制
name: CI

on:
  push:
    paths:
    ### If a push was applied on one of these files, the CI workflow is triggered.###
    ### I want to know which file triggered the CI workflow and save it to a variable s I can use later in the CI steps ###
    - 'dwh/helm/values-versions.yaml' 
    - 'ai/helm/values-versions.yaml'
    - 'platform/helm/values-versions.yaml'

jobs:
  copy-values-template-to-fluent-bit:
      runs-on: self-hosted
      container:
        image: ghcr.io/***/myImage
        credentials:
          username: ${{ secrets.GHCR_USER }}
          password: ${{ secrets.GHCR_PASS }}
      steps:
        - uses: actions/checkout@v2
        - name: show repo files
          run: |
            pwd
            ls -l

我需要一种方法来找出是哪个文件触发了CI工作流,并将其保存到一个变量中。

EN

回答 1

Stack Overflow用户

发布于 2021-07-06 21:15:24

您可以使用此操作Get All Changed Files

代码语言:javascript
复制
- id: files
  uses: jitterbit/get-changed-files@v1
- run: |
    for changed_file in ${{ steps.files.outputs.all }}; do
      echo "Do something with this ${changed_file} to check if this is you file and set variable."
    done
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68269467

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档