github-push-action icon indicating copy to clipboard operation
github-push-action copied to clipboard

Directory doesn't seem to be working

Open gwolbers opened this issue 5 years ago • 1 comments

I've got two repo's: test_workflow en test_workflow_dev. Repo test_workflow runs an ant-build and puts the result in directory output. I only want to push the content of directory output to repository test_workflow_dev. My yaml-file looks like this:

name: push output

on:
  push:
    paths:
    - 'input/**.docx'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        persist-credentials: false
        fetch-depth: 0
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Build with Ant
      run: ant -noinput -buildfile build.xml -lib ./lib
    - name: Commit files
      run: |
        git config --local user.email [mail]
        git config --local user.name [user]
        git add ./output
        git commit -m "Update output"
    - name: Push changes
      uses: ad-m/github-push-action@master
      with:
        github_token: ${{ secrets.USER_TOKEN }}
        directory: './output'
        repository: '[user]/test_workflow_dev'

When I use 'force: true' the whole repo test_workflow is pushed, not only output, but I get no errors. When I omit 'force: true', I get errors:

Run ad-m/github-push-action@master
  with:
    github_token: ***
    directory: ./output
    repository: [user]/test_workflow_dev
    branch: master
  env:
    JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.252/x64
    JAVA_HOME_8.0.252_x64: /opt/hostedtoolcache/jdk/8.0.252/x64
Started: bash /home/runner/work/_actions/ad-m/github-push-action/master/start.sh
Push to branch master
To https://github.com/[user]/test_workflow_dev.git
 ! [rejected]        HEAD -> master (fetch first)
error: failed to push some refs to 'https://github.com/[user]/test_workflow_dev.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  code: 1
}
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:9:19)

Is this a bug or am I doing something wrong? I hope it's the last.

Help appreciated.

gwolbers avatar Jul 09 '20 19:07 gwolbers

Looks related to https://github.com/ad-m/github-push-action/issues/50

kramrm avatar Sep 13 '20 20:09 kramrm