Closed penglei0 closed 1 year ago
Describe the bug Fail to call createCommit
createCommit
To Reproduce Steps to reproduce the behavior:
Please use the following yaml to reproduce。
jobs: use-github-script: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 2 - name: Create a new file run: | touch ${{github.workspace}}/log.txt echo "parent=`git rev-parse HEAD`" >> "$GITHUB_ENV" git hash-object -w ${{github.workspace}}/log.txt git update-index --add ${{github.workspace}}/log.txt echo "object_tree=`git write-tree`" >> "$GITHUB_ENV" - name: Commit to repo uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const commit_msg = "feat: example of add a file" const parent = "${{ env.parent}}"; const object_tree = "${{ env.object_tree}}""; const response = await github.rest.git.createCommit({ owner: context.repo.owner, repo: context.repo.repo, message: commit_msg, tree: object_tree, parents: [parent] });
Expected behavior expect to run the createCommit successfully
Screenshots
type-o my friend, right at
const object_tree = "${{ env.object_tree}}"";
type-o my friend, right at const object_tree = "${{ env.object_tree}}"";
@station70-daniel thanks!
Describe the bug Fail to call
createCommit
To Reproduce Steps to reproduce the behavior:
Please use the following yaml to reproduce。
Expected behavior expect to run the createCommit successfully
Screenshots