diff --git a/.github/workflows/pack_img.yaml b/.github/workflows/pack_img.yaml index 46f2b4b..925a47c 100644 --- a/.github/workflows/pack_img.yaml +++ b/.github/workflows/pack_img.yaml @@ -28,10 +28,21 @@ jobs: - name: Run image stitching script run: | - python your_script.py # 运行你的 Python 脚本(替换为你的脚本文件名) + python auto_pack_img.py # 运行你的 Python 脚本(替换为你的脚本文件名) - name: Save stitched image as artifact uses: actions/upload-artifact@v3 with: - name: stitched_image # 上传生成的图片作为 artifact - path: optimized_stitched_image.jpg # 替换为你生成图片的路径 + name: stitched_image # 上传生成的图片作为 artifact + path: auto_img.png # 替换为你生成图片的路径 + + + - name: Commit and push updated file + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add auto_img.png # 添加你想要提交的文件 + git commit -m "Update file with new data" + git push origin main # 推送更改回 main 分支 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 提供的 Token 推送更改 diff --git a/auto_pack_img.py b/auto_pack_img.py index b549c7e..1cf3c92 100644 --- a/auto_pack_img.py +++ b/auto_pack_img.py @@ -104,10 +104,10 @@ def load_images_from_folder(folder): -folder = 'testimg' +folder = 'pullrequests' images = load_images_from_folder(folder) stitched_image = stitch_images_bin_packing(images) -cv2.imwrite('stitched_image_rect.jpg', stitched_image) +cv2.imwrite('auto_img.png', stitched_image)