add-and-commit icon indicating copy to clipboard operation
add-and-commit copied to clipboard

pushing a commit to the branch that the github action is ran on

Open callum-maguire opened this issue 3 years ago • 1 comments

 - uses: EndBug/[email protected]
        with:
          add: 'something/frontend/src/locales/en/en.json'
          message: '[skip ci] Update translations from scanner'
          push: --force

This works but we want to run on the latest version

so we migrated to

 - uses: EndBug/[email protected]
        with:
          add: 'something/frontend/src/locales/en/en.json'
          message: '[skip ci] Update translations from scanner'
          push: --force

This is not working, the error is Error: fatal: You are not currently on a branch.

Thank you for any help or assistance in advance

callum-maguire avatar Sep 09 '22 09:09 callum-maguire

Since v8.0.0, the action works with whatever has been checked out in previous steps (changelog). If you check out the branch you want to push to with either git commands or actions/checkout, then the action will push to that branch. You can also use the pull input to run git pull before creating the commit.

EndBug avatar Sep 12 '22 21:09 EndBug

@callum-maguire I got it working with the following


      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.head.ref }}

    ....

      - name: Update pull request
        uses: EndBug/add-and-commit@v9
        with:
          author_name: i18n Extract
          committer_name: GitHub Actions
          committer_email: 41898282+github-actions[bot]@users.noreply.github.com
          add: '*.xlf'
          fetch: false

Hope this helps you too.

anuj-scanova avatar Sep 28 '22 16:09 anuj-scanova

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 18 '22 17:10 github-actions[bot]