GitHub 操作的输出为空

2023-12-25

我正在创建我的第一个 GitHub 操作,但我不明白为什么输出为空。

动作.yml

name: "Run Endtest functional tests"
description: "Register a deployment event with Endtest and run the functional tests"
branding:
  icon: play-circle
  color: white
inputs:
  app_id:
    description: 'The Endtest App ID for your account. You can get it from the https://endtest.io/settings page.'
    required: true
  app_code:
    description: 'The Endtest App Code for your account. You can get it from the https://endtest.io/settings page.'
    required: true
  api_request:
    description: 'The Endtest API request for starting the test execution.'
    required: true
  number_of_loops:
    description: 'The number of times the API request for fetching the results will be sent once every 30 seconds.'
    required: true

outputs:
  test_suite_name:
    description: "The name of the test suite"
  configuration:
    description: "The configuration of the machine or mobile device on which the test was executed"
  test_cases:
    description: "The number of test cases"
  passed:
    description: "The number of assertions that have passed"
  failed:
    description: "The number of assertions that have failed"
  errors:
    description: "The number of errors that have been encountered"
  start_time:
    description: "The timestamp for the start of the test execution."
  end_time:
    description: "The timestamp for the end of the test execution."
  #detailed_logs:
    #description: "The detailed logs for the test execution"
  #screenshots_and_video:
    #description: "The URLs for the screenshts and video recordings of the test execution"

runs:
  using: "composite"
  steps:
    - run: sudo apt-get install jq
      shell: bash 
    - run: sudo chmod +x ${{ github.action_path }}/test.sh
      shell: bash 
    - run: echo "${{ inputs.api_request }}"
      shell: bash 
    - run: ${{ github.action_path }}/test.sh ${{ inputs.app_id }} ${{ inputs.app_code }} "${{ inputs.api_request }}" ${{ inputs.number_of_loops }} 
      shell: bash

test.sh

#!/bin/bash
set -e
hash=$(curl -X GET --header "Accept: */*" "${3}")
for run in {1.."${4}"}
do
  sleep 30
  result=$(curl -X GET --header "Accept: */*" "https://endtest.io/api.php?action=getResults&appId=${1}&appCode=${2}&hash=${hash}&format=json")
  if [ "$result" == "Test is still running." ]
  then
    status=$result
    # Don't print anything
  elif [ "$result" == "Processing video recording." ]
  then
    status=$result
    # Don't print anything
  elif [ "$result" == "Stopping." ]
  then
    status=$result
  elif [ "$result" == "Erred." ]
  then
    status=$result
    echo $status
  elif [ "$result" == "" ]
  then
    status=$result
    # Don't print anything
  else
     testsuitename=$( echo "$result" | jq '.test_suite_name' )
     configuration=$( echo "$result" | jq '.configuration' )
     testcases=$( echo "$result" | jq '.test_cases' )
     passed=$( echo "$result" | jq '.passed' )
     failed=$( echo "$result" | jq '.failed' )
     errors=$( echo "$result" | jq '.errors' )
     #detailedlogs=$( echo "$result" | jq '.detailed_logs' )
     #screenshotsandvideo=$( echo "$result" | jq '.screenshots_and_video' )
     starttime=$( echo "$result" | jq '.start_time' )
     endtime=$( echo "$result" | jq '.end_time' )   
     
     echo $testsuitename
     echo $configuration
     echo $testcases
     echo $passed
     echo $failed
     echo $errors
     echo $starttime
     echo $endtime
     
     echo "::set-output name=test_suite_name::$testsuitename"
     echo "::set-output name=configuration::$configuration"
     echo "::set-output name=test_cases::$testcases"
     echo "::set-output name=passed::$passed"
     echo "::set-output name=failed::$failed"
     echo "::set-output name=errors::$errors"
     echo "::set-output name=start_time::$starttime"
     echo "::set-output name=end_time::$endtime"
     #echo "::set-output name=detailed_logs::$detailedlogs"
     #echo "::set-output name=screenshots_and_video::$screenshotsandvideo"
     exit 0
  fi
done
exit

我已经在 GitHub Marketplace 上发布了该操作,并且我正在尝试使用它/从另一个存储库测试它,如下所示:

main.yml

name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Run a one-line script
        run: echo Hello, world!
        
      - name: Run Endtest functional tests
        id: endtest_functional_tests
        uses: endtest-technologies/[email protected] /cdn-cgi/l/email-protection
        with:
          app_id: "85205402"
          app_code: "79973826"
          api_request: "https://endtest.io/api.php?action=runTestSuite&appId=85205402&appCode=79973826&testSuite=106877&selectedPlatform=windows&selectedOs=a&selectedBrowser=chrome&selectedResolution=d&selectedLocation=sanfrancisco&selectedCases=491130&writtenAdditionalNotes="
          number_of_loops: 6
          
      - name: Get the test suite name output
        run: echo "${{ steps.endtest_functional_tests.outputs.test_suite_name }}"
        
      - name: Get the configuration output
        run: echo "${{ steps.endtest_functional_tests.outputs.configuration }}"

      
      - name: Get multiple outputs
        run: |
          echo "${{ steps.endtest_functional_tests.outputs.test_suite_name }}"
          echo "${{ steps.endtest_functional_tests.outputs.configuration }}"

查看构建中的日志。我可以看到我的操作已成功调用,API 请求开始,我可以看到打印出来的输出,直到带有的部分::set-output.

我的 GitHub 操作生成的输出是空的。

我真的很感激对此的一些帮助,因为我在过去的两天里一直在努力让它发挥作用。

根据我的阅读,应该可以使用::set-output来自 .sh 文件,就像这个人在这个中所做的那样article https://www.philschmid.de/create-custom-github-action-in-4-steps.


您只是设置操作最后一步的输出,而不是操作的输出。

你必须设置value使用步骤的输出来计算操作的输出(根据https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-composite-actions https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-composite-actions).

name: "Run Endtest functional tests"
description: "Register a deployment event with Endtest and run the functional tests"
branding:
  icon: play-circle
  color: white
inputs:
  [...]
outputs:
  test_suite_name:
    description: "The name of the test suite"
    value: ${{ steps.run-script.outputs.test_suite_name }}
  [...]

runs:
  using: "composite"
  steps:
    - run: sudo apt-get install jq
      shell: bash 
    - run: sudo chmod +x ${{ github.action_path }}/test.sh
      shell: bash 
    - run: echo "${{ inputs.api_request }}"
      shell: bash 
    - run: ${{ github.action_path }}/test.sh ${{ inputs.app_id }} ${{ inputs.app_code }} "${{ inputs.api_request }}" ${{ inputs.number_of_loops }} 
      shell: bash
      id: run-script
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

GitHub 操作的输出为空 的相关文章

  • 如何在 JS 文件中使用 Github 机密

    我有一个基本的 git 存储库 其中包含用于构建和部署的 github 操作 主要是 HTML 和 TS 文件 但是我必须在一些需要保密的 API 密钥中使用 所以我想办法为他们使用 GITHUB SECRETS 如何在我的 js 或 TS
  • python等待shell命令完成

    我正在运行脚本来解压缩一些文件 然后删除 rar 文件 我通过 shell 运行命令来完成此操作 我尝试了几种不同的方法来让脚本等待文件解压完成 但它仍然继续并在文件使用完成之前删除文件 我已经尝试过下面的代码 这是行不通的 我试图看看是否
  • 使用两个帐户推送到 Git

    我跟着这个tuotrial http code tutsplus com tutorials how to work with github and multiple accounts net 22574关于如何在同一台计算机上拥有两个单独
  • Git - 显示远程分支的远程名称

    是否有一个 Git 命令可以显示远程分支的远程名称 目前 我坚持使用 shell utils 从远程分支引用中提取远程名称 例如 echo remote name branch name sed r s 1 remote name 有时出于
  • 在ubuntu中打开spyder

    我想在ubuntu中打开spyder Python IDE 通常我会在 shell 中编写 spyder 它会打开spyder IDE 现在 当我在shell中编写spyder时 它只是换行 什么也没有发生 类似于按 enter 我如何找回
  • 签出现有的远程分支

    我见过不同的方法来检查现有的远程分支 假设我的朋友推送了新分支 bigbug 并且我想签出并将我的本地工作副本切换到该分支 我有以下选项 1 git checkout b bigbug origin bigbug 2 git checkou
  • 在 Linux 中重新启动时,新创建的文件变为 0 kb(数据被覆盖为空)

    我遇到了一个奇怪的问题 这让我发疯 当前的任务是在 root 用户第一次登录时启动一组文件 并在同一用户第二次登录时启动另一组文件 我决定使用 profile 和 bashrc 文件 并在第一次登录期间发生的任务结束时重新加载 bashrc
  • 有哪些基于对象的 shell?

    我打算写一个面向对象的shell 基于Python 我已经有很多想法了 但在实现它之前 我想通过一些现有的 shell 来激发我的灵感 我所说的面向对象的基本意思是 参数不仅仅是字符串数组 而且是对象数组 返回值也是一个对象 不仅有 std
  • system 和 shell_exec 之间的区别

    有什么区别shell exec and systemPHP 中的方法 两者都采用单个命令行参数并在 PHP 中运行 使用其中一种比另一种更好吗 请参阅此处的解释 http chipmunkninja com Program Executio
  • 有关多个远程存储库的 Git 状态

    我有一个脚本 如果我忘记在 40 多个存储库中提交或推送一些代码 它会通过电子邮件向我发送提醒 在我的两个项目中 我遵循了这些帖子中的答案 其中我设置了 git push 来推送到多个存储库 从多个远程位置拉 推 https stackov
  • web2py git 集成 - localhost 和 pythonanywhere

    我完全不知道如何将 Github 集成到 web2py 中 我在 USB 上安装了 web2py任何地方的Python http www pythonanywhere com web2py概述文档chapter3http web2py co
  • 如何并行执行4个shell脚本,我不能使用GNU并行?

    我有4个shell脚本dog sh bird sh cow sh和fox sh 每个文件使用 xargs 并行执行 4 个 wget 来派生一个单独的进程 现在我希望这些脚本本身能够并行执行 由于某些我不知道的可移植性原因 我无法使用 GN
  • 如何删除 Github Desktop 上的本地分支?

    上周我将 Windows Github 升级到Github 桌面 https desktop github com 这肯定比他们上次为 Github Windows 所做的更新要快得多 它还有一个不错的提交视觉时间表 也许我很愚蠢 但是删除
  • 强制 Composer 下载 git repo 而不是 zip

    我对作曲家有一些问题 require php gt 5 3 2 kriswallsmith buzz 0 7 Repo https github com kriswallsmith Buzz tree v0 7 https github c
  • SSH,运行进程然后忽略输出

    我有一个命令可以使用 SSH 并在 SSH 后运行脚本 该脚本运行一个二进制文件 脚本完成后 我可以输入任意键 本地终端将恢复到正常状态 但是 由于该进程仍在我通过 SSH 连接的计算机中运行 因此任何时候它都会登录到stdout我在本地终
  • shell中如何分割字符串

    我有一个变量作为 string ABC400p2q4 我怎样才能分开ABC400 and p2q4 我需要将它分成两个变量 结果我得到 echo var1 ABC400 echo var2 p2q4 可以用任何字母字符代替 ABC 可以用任
  • 从另一个工作流程触发新的工作流程?

    我可以从另一个工作流程触发新的工作流程吗 我试图在第一个工作流程推送新版本后运行工作流程 但它似乎忽略了它 正如这里所描述的 https stackoverflow com a 65698892 4964553 您可以使用以下命令触发另一个
  • 在 .gitconfig 中隐藏 GitHub 令牌

    我想将所有点文件存储在 GitHub 上 包括 gitconfig 这需要我将 GitHub 令牌隐藏在 gitconfig 中 为此 我有一个 gitconfig hidden token 文件 这是我打算编辑并放在隐藏令牌的 git 下
  • 检查帐号是否为数字时出现语法错误

    if account nr 0 9 from account nr 0 9 这是为了检查帐号是否为数字 我收到语法错误 这个问题的早期版本缺少之间的空格if and 实际代码具有所需的空间 它显示以下错误消息 syntax error ac
  • 在 VBA 中捕获 shell 命令的输出值?

    发现这个功能http www cpearson com excel ShellAndWait aspx http www cpearson com excel ShellAndWait aspx 但我还需要捕获 shell 的输出 有什么代

随机推荐

  • 如何完美同步两个或多个html5视频标签?

    有没有办法让两个或更多 最好是三个 html5标签同时播放并完美同步 如果我有一个视频的三个图块 我希望它们作为一个大视频出现在浏览器中 他们需要成为完美同步 甚至没有最小的视觉 垂直提示表明它们是平铺的 不幸的是我无法使用 MediaCo
  • 有没有办法检查 NumPy 数组是否共享相同的数据?

    我的印象是 在 NumPy 中 两个数组可以共享相同的内存 举个例子 import numpy as np a np arange 27 b a reshape 3 3 3 a 0 5000 print b 0 0 0 5000 Some
  • 运行 Quartz.NET 嵌入式或作为 Windows 服务的优缺点

    我想将quartz调度添加到ASP NET应用程序中 它将用于发送排队的电子邮件 将quartz net 作为 Windows 服务运行与嵌入式相比有何优缺点 我主要关心的是嵌入模式下的 Quartz NET 如何处理 IIS 中可变数量的
  • VSCode - 保存时禁用所有自动格式化

    我正在编辑别人的代码 我只想更改 9000 行文件中的 1 行 但每次保存时 VS Code 都会格式化整个文件并删除所有尾随空格 这是一个禁忌 因为当我把它推上去时 审阅者将不知道该看哪一行 我尝试禁用 prettier 将所有文件添加到
  • iPhone + Drupal + JSON RPC 服务器问题

    我不知道如何使用 Obj C 发布 JSON RPC 请求 谁能帮我 到目前为止我有 responseData NSMutableData data retain NSMutableURLRequest request NSMutableU
  • 使用 getNodeSet 解析 XML - 识别缺失的标签

    我正在解析 XML 文件getNodeSet 假设我有一个来自书店的 XML 文件 其中列出了 4 本书 但其中一本书缺少 作者 标签 如果我使用以下方法解析 XML 中的标签 authors data nodes 2 lt getNode
  • android edittext的最小值和最大值

    我正在开发一个android应用程序 实际上我需要为编辑文本条目设置最小值和最大值我的最小值是18 最大值是65 我做了这个的确切代码 package com test import android text InputFilter imp
  • CSS 按钮在 Google Chrome 中不起作用?

    我正在为一家电影公司的网站制作一个主页 它有一个带有悬停效果的 CSS 按钮 一旦准备好就会打开一个灯箱 目前我只是将其设置为 href 作为一个占位符 直到我准备好实现灯箱 还有一个向下箭头的小图像 链接设置为尚未出现在页面上的锚点 这两
  • ios7 UIWebView Youtube 视频

    我有一个 UIWebView 子类 用来播放 youtube 和本地视频 在iOS6下完美运行 在升级到 iOS7 的过程中 我遇到了一个问题 我真的不知道从哪里开始 虽然子类似乎仍然可以在 iOS7 模拟器上播放 youtube 和本地视
  • 在通用方法中将值转换为 T

    我有一个破旧的属性映射的界面 interface IPropertyMap bool Exists string key int GetInt string key string GetString string key etc 我想创建一
  • 有没有办法检测 Facebook Javascript SDK 是否加载成功?

    我使用 Facebook 作为我网站的会员系统 它使用代码生成登录控件 允许用户通过 Facebook 帐户登录 如果他们已经是会员 则基本上只需单击一下 如果不是会员 则只需单击 2 次 用于授予权限 但我遇到了问题 反馈表明登录按钮并不
  • 在 Eclipse IDE 中恢复已删除的文件

    两天前 我在 Eclipse IDE 中删除了五个 Java 文件 现在我需要它们 我试图从当地历史中恢复它们 我只恢复了其中两个 当我右键单击其他文件 然后单击从本地历史记录恢复时 收到错误消息No additional members
  • 处理大文件的最佳 Python Zip 模块是什么?

    编辑 特别是压缩和提取速度 有什么建议么 Thanks 所以我制作了一个随机的大压缩文件 ls l zip rw r r 1 aleax 5000 115749854 Nov 18 19 16 large zip unzip l large
  • ASP.NET MVC 帐户控制器使用指南?

    我正在查看 MVC 帐户控制器 它似乎来自 ASP NET Webforms 有没有关于如何使用它的好的背景信息 您可以将其映射到用户数据库表还是最好进行自己的用户管理 如何在 MVC 中使用它来限制登录用户可以查看的页面 您必须自己完成所
  • 没有可用的缓冲区空间(已达到最大连接?)表单 Postgres EDB 驱动程序

    我们在通过 java 应用程序连接到数据库时遇到异常 堆栈跟踪如下 com edb util PSQLException The connection attempt failed at com edb core v3 Connection
  • 如何使用 Windows 任务计划程序安全地存储每天运行的脚本的密码?

    我编写了一个PowerShell脚本来执行一些操作 操作完成后 我希望脚本使用以下命令发送邮件Send MailMessage cmdlet 为此 我使用了谷歌的应用程序密码功能 但我对将应用程序密码以纯文本形式存储在脚本本身中没有信心 我
  • 了解 Firebase 云功能中 Firebase 存储中存储的视频的持续时间的最简单方法是什么?

    我有一个基于触发器的云函数 应该可以找到上传到 Firebase Storage 的视频的持续时间 我尝试使用以下 npm 模块 get video duration https www npmjs com package get vide
  • 这是解析 XML 的低效方法吗?

    我可能担心错误的优化 但我有一个挥之不去的想法 它一遍又一遍地解析 xml 树 也许我在某个地方读过它 不记得了 无论如何 这就是我正在做的事情 using System using System Collections Generic u
  • 在奏鸣曲管理中隐藏下载按钮

    我想从某些自定义实体中隐藏 Sonata Admin 上的 下载 按钮 如何隐藏 删除它 如果我覆盖base list html twig并从 table footer 中删除下载按钮 它会消失所有实体列表 有什么办法可以将其隐藏在 Adm
  • GitHub 操作的输出为空

    我正在创建我的第一个 GitHub 操作 但我不明白为什么输出为空 动作 yml name Run Endtest functional tests description Register a deployment event with