EndBug / add-and-commit

:octocat: Automatically commit changes made in your workflow run directly to your repo
MIT License
1.14k stars 117 forks source link

`commit_sha` returns the full SHA instead of the 7-character SHA #501

Closed DenverCoder1 closed 1 year ago

DenverCoder1 commented 1 year ago

Describe the bug

commit_sha and commit_long_sha seem to return the same value even though commit_sha is supposed to be the short version according to the docs.

This seems like it is relevant to this release - https://github.com/steveukx/git-js/releases/tag/simple-git%403.6.0

committed: true
commit_long_sha: b3e6c9089a49153e1f3ffe4d93dfb8aad9fa961e
commit_sha: b3e6c9089a49153e1f3ffe4d93dfb8aad9fa961e

Workflow used

name: Add and Commit Test
on:
  workflow_dispatch:

jobs:
  run:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v3
      - run: date > test.txt
      - uses: EndBug/add-and-commit@main
        id: add-and-commit
      - run: |
          echo "committed: ${{ steps.add-and-commit.outputs.pushed }}"
          echo "commit_long_sha: ${{ steps.add-and-commit.outputs.commit_long_sha }}"
          echo "commit_sha: ${{ steps.add-and-commit.outputs.commit_sha }}"
        shell: bash

Expected behavior

committed: true
commit_long_sha: b3e6c9089a49153e1f3ffe4d93dfb8aad9fa961e
commit_sha: b3e6c90

Logs Either provide a link to the action run or (if your repo is private) paste here the logs from the step that uses it. If you paste the logs, please use this template, and remember to paste the logs from all the different sections.

Logs
Run EndBug/add-and-commit@main
  with:
    add: .
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    push: true
    github_token: ***
Running in /home/runner/work/action-test-repo/action-test-repo
Add input parsed as single string, running 1 git add command.
> Using 'DenverCoder1 ' as author.
> Using "Commit from GitHub Actions (Add and Commit Test)" as commit message.
Internal logs
  > Staging files...
  > Adding files...
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 1 changed files.
  > Fetching repo...
  {
    raw: '',
    remote: 'https://github.com/DenverCoder1/action-test-repo',
    branches: [ { name: 'gh-pages', tracking: 'origin/gh-pages' } ],
    tags: []
  }
  > Not pulling from repo.
  > Creating commit...
  {
    author: null,
    branch: 'main',
    commit: 'b3e6c9089a49153e1f3ffe4d93dfb8aad9fa961e',
    root: false,
    summary: { changes: 1, insertions: 1, deletions: 1 }
  }
  > No tag info provided.
  > Pushing commit to repo...
  {
    pushed: [],
    update: {
      head: { local: 'refs/heads/main', remote: 'refs/heads/main' },
      hash: { from: 'ab1ab2f', to: 'b3e6c90' }
    },
    repo: 'https://github.com/DenverCoder1/action-test-repo',
    ref: { local: 'refs/remotes/origin/main' },
    remoteMessages: It { all: [] }
  }
  > No tags to push.
> Task completed.
Outputs
  committed: true
  commit_long_sha: b3e6c9089a49153e1f3ffe4d93dfb8aad9fa961e
  commit_sha: b3e6c9089a49153e1f3ffe4d93dfb8aad9fa961e
  pushed: true
  tagged: false
  tag_pushed: false