<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Github Action on 又一只松鼠阿~</title>
    <link>https://www.songshua.cn/tags/github-action/</link>
    <description>Recent content in Github Action on 又一只松鼠阿~</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 22 Aug 2023 18:02:47 +0800</lastBuildDate><atom:link href="https://www.songshua.cn/tags/github-action/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>014.使用Github action复制分支文件到同仓库的另一个分支</title>
      <link>https://www.songshua.cn/post/014-use-github-action-to-copy-the-branch-file-to-another-branch-of-the-same-warehouse-z2p50an.html</link>
      <pubDate>Tue, 22 Aug 2023 18:02:47 +0800</pubDate>
      
      <guid>https://www.songshua.cn/post/014-use-github-action-to-copy-the-branch-file-to-another-branch-of-the-same-warehouse-z2p50an.html</guid>
      <description>&lt;p&gt;来源：&lt;a href=&#34;https://github.com/marketplace/actions/file-sync&#34;&gt;&lt;/a&gt;&lt;a href=&#34;https://github.com/marketplace/actions/file-sync&#34;&gt;https://github.com/marketplace/actions/file-sync&lt;/a&gt;&lt;br&gt;
看第二个回答： &lt;a href=&#34;https://stackoverflow.com/questions/69577518/github-action-to-copy-specific-folders-from-one-branch-to-another-in-the-same-re&#34;&gt;&lt;/a&gt;&lt;a href=&#34;https://stackoverflow.com/questions/69577518/github-action-to-copy-specific-folders-from-one-branch-to-another-in-the-same-re&#34;&gt;https://stackoverflow.com/questions/69577518/github-action-to-copy-specific-folders-from-one-branch-to-another-in-the-same-re&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  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: &#39;static&#39;
            TARGET_BRANCH: &#39;dest&#39;
          run: |
            files=$(find $SRC_FOLDER_PATH -type f) # get the file list
            git config --global user.name &#39;GitHub Action&#39;
            git config --global user.email &#39;action@github.com&#39;
            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 &amp;quot;deploy files&amp;quot;  # commit to the repository (ignore if no modification)
            git push origin $TARGET_BRANCH # push to remote branch
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
  </channel>
</rss>