Github 行动未 运行 推送,仅按计划进行

Github Action is not Running on Push, only on schedule

基于this article, I am trying to generate a repo that runs everytime y push, but also every 4 or 8 hours. as seen by the action history,只有一个成功,而且只有一个Mac Machine:

但我的目标是 运行 在 ubuntu-latest、windows-latest 和 macos-latest 打开它以检查所有 OS 中的代码。一个最终目标是使计划推送的消息在 xxx 日期更新。这是我在 9 月 23 日 编辑的最新代码,可以在 this repo:

中看到
name: render readme

on:
  push:
    paths:
      - README.Rmd
  schedule:
  - cron: 0 */4 * * *

jobs:
  render:
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v2
      - uses: r-lib/actions/setup-r@v1
      - uses: r-lib/actions/setup-pandoc@v1
      - name: "[Custom block] [macOS] Install spatial libraries"
        if: runner.os == 'macOS'
        run: |
          # conflicts with gfortran from r-lib/actions when linking gcc
          rm '/usr/local/bin/gfortran'
          brew install pkg-config gdal proj geos
      - name: "[Stage] [macOS] Install libgit2"
        if: runner.os == 'macOS'
        run: brew install libgit2
      - name: Install packages
        run: Rscript -e 'install.packages(c("rmarkdown", "pacman", "rgeos"))'
      - name: install rgdal
        run: Rscript -e 'install.packages("rgdal", configure.args = c("--with-proj-lib=/usr/local/lib/", "--with-proj-include=/usr/local/include/"))'
      - name: Render README
        run: Rscript -e 'rmarkdown::render("README.Rmd", output_format = "md_document")'
      - name: Commit results
        run: |
          git add README.md man/figures/README-*
          git commit README.md -am 'Re-build README.md' || echo "No changes to commit"
          git push origin main || echo "No changes to commit"

现在它 运行s 它实际上给了我一个勾号,但是 md 没有更新,在名为 commit results 的任务的 运行s 内我们可以看到以下内容错误

Run git add README.md man/figures/README-*
  git add README.md man/figures/README-*
  git commit README.md -am 'Re-build README.md' || echo "No changes to commit"
  git push origin main || echo "No changes to commit"
  shell: /bin/bash -e {0}
  env:
    R_LIBS_USER: /Users/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
fatal: paths 'README.md ...' with -a does not make sense
No changes to commit
Everything up-to-date

所以提交或推送不起作用,谢谢@krzysztof-madej,你发现了一个错误,即分支名称,但我仍然可以让结果更新自述文件,即使它 运行顺利

Objective: 运行 它在 ubuntu-latest, windows-latestmacos-latest 上检查所有 OS 中的代码:

runs-on: ${{ matrix.os }}
strategy:
  matrix:
    os:
      - ubuntu-latest
      - macos-latest
      - windows-latest

您的问题似乎与 git 有关,而不是 git 集线器操作。 -a arg 将暂存所有文件,因此添加 README.md 似乎会使命令无效。尝试更改:

git commit README.md -am 'Re-build README.md' || echo "No changes to commit"

git commit -am 'Re-build README.md' || echo "No changes to commit"