You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Actions手动触发workflow问题:UI中无触发按钮

问题排查与修复

核心问题:Run命令语法错误

你的工作流无法被GitHub正确识别,是因为decode keys步骤的run命令存在语法问题——两行echo命令没有正确分隔,GitHub Actions无法解析这个多行命令,导致工作流配置无效,因此不会在Actions标签页显示手动触发按钮。

修复方案

修正decode keys步骤的命令写法,同时补充base64解码的必要参数(原命令缺少解码标识,会导致文件内容错误):

修正后的完整工作流代码

name: Publish On CI

on:
  workflow_dispatch:
    inputs:
      publish:
        description: 'Choose where you want to publish the build'
        required: true
        default: AppTester
        type: choice
        options:
          - GooglePlay
          - AppTester
          - Both

env:
  ANDROID_KEYS_FOLDER: ..

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: decode keys
        # 用多行语法分隔命令,同时添加base64解码参数-d
        run: |
          echo "${{ secrets.APP_PROPERTIES_BASE64 }}" | base64 -d > app.properties
          echo "${{ secrets.APP_RELEASE_BASE64 }}" | base64 -d > app-release
      - name: set up JDK 11
        uses: actions/setup-java@v3
        with:
          java-version: '11'
          distribution: 'temurin'
          cache: gradle

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Run Unit test
        run: ./gradlew testStagingUnitTest
      - name: Build
        run: ./gradlew :app:assembleStaging
      - name: Publish on Google Play if required
        if: inputs.publish == 'GooglePlay'
        run: echo "Publishing on Google Play"
      - name: Publish on Firebase if required
        if: inputs.publish == 'AppTester'
        run: echo "Publishing on Firebase"
      - name: Publish on Google Play and Firebase if required
        if: inputs.publish == 'Both'
        run: echo "Publishing on Google Play and Firebase"

关键修改点

  1. 修复命令分隔:使用|将两行echo命令转为多行写法,确保GitHub Actions能正确识别每一条命令。
  2. 补充解码参数:添加base64 -d参数,否则只会将base64字符串直接写入文件,无法完成解码操作,后续依赖该文件的步骤会出错。

额外确认项

  • 确保工作流文件存放在项目根目录的.github/workflows/文件夹下,文件名以.yml或.yaml结尾。
  • 提交修改后的文件到仓库,刷新GitHub的Actions标签页,即可看到Publish On CI工作流的手动触发按钮。

内容的提问来源于stack exchange,提问作者kingston

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 06:10:34