在 Github Actions 中,我尝试对与工作流所属存储库不同的存储库进行一些更改。看到这个代码:
- name: Generate API module
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git clone https://user:$GITHUB_TOKEN@github.com/owner/my-repo # This works
cd my-repo
git config user.name "user"
git config user.email "dev@example.com"
git checkout -b api-version-$COMMIT
touch new-file.sh
git add new-file.sh
git commit -m "Add new file"
git remote -v # Prints:
# origin ***github.com/owner/my-repo.git (fetch)
# origin ***github.com/owner/my-repo.git (push)
git push --set-upstream origin api-version-$COMMIT # This does not work
git push --set-upstream https://user:$GITHUB_TOKEN@github.com/owner/my-repo api-version-$COMMIT # This does not work …Run Code Online (Sandbox Code Playgroud)