如何在GitHub Action中的GitHub回购中运行单独的脚本

发布于 2025-02-06 06:52:46 字数 957 浏览 0 评论 0原文

尝试在GitHub操作上实现工作流,该操作将运行带有我的软件包功能的测试脚本,并理想地打印/导出结果。我是YAML语法的新手,并感谢任何帮助。

这是我当前拥有的工作流程:

on:
  push:
    branches:
      - main
      - master
  pull_request:
    branches:
      - main
      - master

name: Test-Script

jobs:
  build:
    runs-on: ${{ matrix.config.os }} 

    name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 

    strategy:
      fail-fast: false 
      matrix:
        config:
          - {os: windows-latest, r: 'release'}
          - {os: macOS-latest, r: 'release'} 

    steps:
      - uses: actions/checkout@v2 

      - uses: r-lib/actions/setup-r@v1 
        with:
          r-version: ${{ matrix.config.r }}

      - uses: r-lib/actions/setup-pandoc@v1

      - name: Test against test script
        run: |
          /R/test_script.R #file path in repo
        shell: Rscript {0}

我得到erorr:错误:错误:意外的'/'在“/”中。我尝试了多次调整,但总是会遇到错误或其他说明该文件找不到的。我也想打印出来/出口结果,但我不知道该怎么做。

感谢任何帮助。谢谢。

trying to implement a workflow on Github actions that will run a test script with the functions of my package and ideally print/export out the results. I am new to the YAML syntax and would appreciate any help.

This is the workflow I currently have:

on:
  push:
    branches:
      - main
      - master
  pull_request:
    branches:
      - main
      - master

name: Test-Script

jobs:
  build:
    runs-on: ${{ matrix.config.os }} 

    name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 

    strategy:
      fail-fast: false 
      matrix:
        config:
          - {os: windows-latest, r: 'release'}
          - {os: macOS-latest, r: 'release'} 

    steps:
      - uses: actions/checkout@v2 

      - uses: r-lib/actions/setup-r@v1 
        with:
          r-version: ${{ matrix.config.r }}

      - uses: r-lib/actions/setup-pandoc@v1

      - name: Test against test script
        run: |
          /R/test_script.R #file path in repo
        shell: Rscript {0}

I get the erorr: Error: Error: unexpected '/' in "/". I have tried multiple adjustments but always get that error or another saying that the file cannot be found. I would also like to print out/export out the results but I do not know how to do so.

Would appreciate any help please. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文