我如何使用 GitHub Actions 进行提交和推送

问题描述 投票:0回答:1

我试图推送操作中所做的更改,但它总是抛出错误。 我已经尝试使用具有所有权限的令牌,但它仍然不起作用。

这是我在 github atcions 中的内容:

- name: Commit and push changes
      env:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
      run: |
        git config --global user.name "Polareti"
        git config --global user.email "[email protected]"
        git add Investimentos.xlsx
        git commit -m "Atualizar arquivo com novos valores [skip ci]"
        git remote set-url origin https://github.com/Polareti/Excel-Automation.git
        git push origin main

这是错误:

github github-actions push
1个回答
0
投票

我能够使用此代码提交并推送

name: Commit and push

on: 
    workflow_dispatch

permissions:
    contents: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: |
          date > generated.txt
          git config user.name github-actions
          git config user.email [email protected]
          git add .
          git commit -m "generated"
          git push
© www.soinside.com 2019 - 2024. All rights reserved.