是否有允许我复制特定文件夹(.eg )的github操作。在同一私人回购中从一个分支转到另一个分支。我很感谢你的帮助。下面是试图用模仿动作让它发挥作用的方法。
name: Copying static files
on:
push:
branches:
- src # Set a branch name to trigger deployment
jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Copycat
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: static.
dst_path: /static/
dst_owner: CompanyX
dst_repo_name: MyRepo
dst_branch: dest
src_branch: src
src_wiki: false
dst_wiki: false
- name: Copycat2
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: dist.
dst_path: /dist/
dst_owner: CompanyX
dst_repo_name: MyRepo
dst_branch: des
src_branch: src
src_wiki: false
dst_wiki: false但我得到了这个错误,即使我有我的个人令牌设置在我的个人资料。
致命:无法读取https://github.com'的密码:没有这样的设备或地址
发布于 2021-10-14 23:13:27
如果您想要提交到同一个存储库,您不必指定个人令牌,只需使用actions/checkout@v2 (参见this)
在分支之间复制文件的一个解决方案是使用git checkout [branch] -- $files,请参阅this post
以下工作流将文件从源分支上名为static的目录复制到名为dest的分支
name: Copy folder to other branch
on: [push]
jobs:
copy:
name: Copy my folder
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: copy
env:
SRC_FOLDER_PATH: 'static'
TARGET_BRANCH: 'dest'
run: |
files=$(find $SRC_FOLDER_PATH -type f) # get the file list
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git fetch # fetch branches
git checkout $TARGET_BRANCH # checkout to your branch
git checkout ${GITHUB_REF##*/} -- $files # copy files from the source branch
git add -A
git diff-index --quiet HEAD || git commit -am "deploy files" # commit to the repository (ignore if no modification)
git push origin $TARGET_BRANCH # push to remote branchhttps://stackoverflow.com/questions/69577518
复制相似问题