简体   繁体   English

为什么我的 GitHub 操作未在分支推送上运行,尽管推送该分支和工作流触发器

[英]Why does my GitHub action not run on branch push, despite push on that branch and workflow triggers

I've been getting started with GitHub Actions (and git/bash).我已经开始使用 GitHub 操作(和 git/bash)。 I have tried (one after another) a workflow with the following triggers:我已经尝试过(一个接一个)具有以下触发器的工作流程

on:
  push:
    paths:
      - contribute-pages/**
      - documentation-pages/**
      - general-pages/**
      - general-strings/**
on:
  push:
    branches:
      - translation-files

However, when the Weblate bot pushes changes to that very folder and branch ( example ) the action does not kick in. Why might that be the case?但是,当Weblate 机器人将更改推送到该文件夹和分支( 示例)时,该操作不会启动。为什么会出现这种情况?

I should note that the Workflow file lives in the 'main' branch, not the 'translation-files' branch it should be reacting to.我应该注意,工作流文件位于“主”分支中,而不是它应该响应的“翻译文件”分支中。 But since the trigger mentions that translation-files branch I would expect that not to be a problem.但是由于触发器提到了翻译文件分支,我希望这不是问题。

Ah, and the action does run when initiated manually:)啊,手动启动时确实会运行该操作:)

Many thanks to all in advance!非常感谢大家提前!

It can't work that way.它不能那样工作。 You need to have workflow file on translation-files branch as well.您还需要在translation-files分支上有工作流文件。

To answer your questions from comments:要从评论中回答您的问题:

Do you know why this is not possible?你知道为什么这是不可能的吗?

Is it not possible to have a workflow in another branch than main/master?除了主/主分支之外,是否不可能在另一个分支中拥有工作流?

You can have workflow in any branch.您可以在任何分支中拥有工作流。 Your branching strategy is a bit out of the ordinary.你的分支策略有点不同寻常。 You have translation-files branch which seems to be long lived branch that doesn't get updated by master, so it doesn't have your workflow and for that reason doesn't get triggered.您有translation-files分支,该分支似乎是长期存在的分支,不会由 master 更新,因此它没有您的工作流程,因此不会被触发。

Github actions is obviously built around Github flow, and for that kind a flow it makes sense to have workflows on each branch. Github 操作显然是围绕 Github 流构建的,对于这种流,在每个分支上都有工作流是有意义的。 If you still don't understand why it is designed that way or don't know what Github flow is, you can start here .如果您仍然不明白为什么要这样设计或者不知道 Github 流程是什么,您可以从这里开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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