繁体   English   中英

github 动作推送未向分支添加新提交

[英]github action push not adding new commit to the branch

我有一个这样的工作流程,其中 myFile.js 正在更新一个文件

- name: Custom action
    run: yarn myFile.js
      
- name: Commit diff
    run: |
      git add .
      git status
      git commit -m "Updating file"
      git status
      git push -u origin origin/${{ github.head_ref }}

这里是output(成功)

git add .
  git status
  git commit -m "Updating file"
  git status
  git push -u origin origin/Feature/custom-patch
  git status
  shell: /usr/bin/bash -e {0}
  env:
    NODE_OPTIONS: --max_old_space_size=4096
HEAD detached at pull/95/merge
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   src/123.json

[detached HEAD 9c7a0fd55] Updating file
 1 file changed, 2 insertions(+), 2 deletions(-)
HEAD detached from pull/95/merge
nothing to commit, working tree clean
To https://github.com/company/myRepo
   35ae5b522..755d05e91  origin/Feature/custom-patch -> origin/Feature/custom-patch
HEAD detached from pull/95/merge
nothing to commit, working tree clean

您需要告诉结帐操作获取整个 state 次提交,并专门告诉它结帐分支。

否则默认情况下它只检查最后一次提交(称为分离的 HEAD)。

- uses: actions/checkout@v2
  with:
    fetch-depth: 0
    ref: ${{ github.event.pull_request.head.ref }}

暂无
暂无

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

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