小编Gui*_*urd的帖子

存储库“http://security.debian.org/debian-security buster/updates InRelease”将其“Suite”值从“stable”更改为“oldstable”

我的一些 Github Actions 工作流最近开始在安装 Chromedriver 时返回此错误:

Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Reading package lists...
E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
E: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
E: Repository 'http://deb.debian.org/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
Error: Process completed with exit code 100.
Run Code Online (Sandbox Code Playgroud)

这是我的步骤实现:

Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB] …
Run Code Online (Sandbox Code Playgroud)

shell debian selenium-chromedriver debian-buster github-actions

47
推荐指数
3
解决办法
1万
查看次数

如何在 if 条件 Github Actions 中检查秘密变量是否为空

语境

我想在执行作业之前检查我的工作流程是否存在秘密。

像这样的东西:

publish:
    runs-on: ubuntu-latest
    if: secrets.AWS_ACCESS_KEY_ID != ''
    steps:
      [ ... ]
Run Code Online (Sandbox Code Playgroud)

但是,在使用此表达式时,我遇到了这样的错误:

The workflow is not valid. .github/workflows/release.yml (Line: 11, Col: 9): Unrecognized named-value: 'secrets'...
Run Code Online (Sandbox Code Playgroud)

我尝试过的

我尝试用另一种方式写这个表达式:

if: ${{ secrets.AWS_ACCESS_KEY_ID != '' }}
Run Code Online (Sandbox Code Playgroud)
if: ${{ secrets.AWS_ACCESS_KEY_ID }} != ''
Run Code Online (Sandbox Code Playgroud)

问题

如何在 Github Actions 工作流程中实现我想要的目标?

github-actions

23
推荐指数
1
解决办法
2万
查看次数

将环境变量输入传递给可重用工作流程

我正在尝试从另一个工作流程调用可重用工作流程,并向其传递一些输入变量。在调用者工作流程中,我有一些环境变量,我想将它们作为输入传递给可重用的工作流程,如下所示:

env:
  SOME_VAR: bla_bla_bla
  ANOTHER_VAR: stuff_stuff

jobs:
  print:
    runs-on: ubuntu-latest
    steps:
      - name: Print inputs passed to the reusable workflow
        run: |
          echo "some var: $SOME_VAR"
          echo "another var: $ANOTHER_VAR"
  call_reusable:
    uses: ...
    with:
      input_var: $SOME_VAR
      another_input_var: $ANOTHER_VAR
Run Code Online (Sandbox Code Playgroud)

可重用的工作流程:

on:
  workflow_dispatch:
  workflow_call:
    inputs:
      input_var:
        required: true
        type: string
      another_input_var:
        required: true
        type: string

jobs:
  the_job:
    runs-on: ubuntu-latest
    steps:
      - name: Print inputs
        run: |
          echo "input_var: ${{ inputs.input_var }}"
          echo "another_input_var: ${{ inputs.another_input_var }}"
Run Code Online (Sandbox Code Playgroud)

Print inputs passed to the …

github-actions

16
推荐指数
2
解决办法
2万
查看次数

文件未使用“-s”进行“gofmt”编辑:为什么会发生这种情况以及如何解决?

每次我们在存储库上打开或更新拉取请求时,我们都会使用 linter(适用于 Golang)来运行 Github Actions 工作流程。

它最近开始返回以下错误

File is not `gofmt`-ed with `-s` (gofmt)

在该文件的其他 PR中发生的事情之后pkg/api/api/go
(编辑:添加链接以评估并最终重现错误)

证据:

原始提交

短绒输出

我想了解这个错误的根源是什么,以及如何解决它?

go gofmt linter github-actions

12
推荐指数
2
解决办法
4万
查看次数

推送事件不会触发推送路径上的工作流程

我目前正在此存储库上测试 GitHub Actions 工作流程。我正在尝试使用这个工作流程

 on: 
   workflow_dispatch:
 
 jobs:
   job:
   runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
       - run: |
           date > report.txt
           git config user.name github-actions
           git config user.email github-actions@github.com
           git add .
           git commit -m "generate or update report.txt file"
           git push
Run Code Online (Sandbox Code Playgroud)

触发此工作流程

on:
  push:
    paths:
      - '**/report.txt'

  pull_request:
    paths:
      - '**/report.txt'

jobs:
  job:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Report .txt file has been updated"
Run Code Online (Sandbox Code Playgroud)

我按照GitHub Actions 文档使用过滤器模式实现了第二个工作流程。

当我report.txt在本地更新文件,然后提交代码并将其推送到存储库时,第二个工作流程将触发。 …

github-actions

9
推荐指数
1
解决办法
3944
查看次数

在 Github Actions 中使用 Poetry 时如何解决 JSONDecodeError?

问题

\n

poetry install自从我从 Python 3.8 迁移到 Python 3.10 以来,我在任何 GitHub 运行器上的 CI/CD 管道(Github Actions)中使用时都遇到问题。

\n
Installing dependencies from lock file\n\nPackage operations: 79 installs, 0 updates, 0 removals\n  \xe2\x80\xa2 Installing pyparsing (3.0.9)\n  \nJSONDecodeError\n  \nExpecting value: line 1 column 1 (char 0)\n  at /opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/json/decoder.py:355 in raw_decode\n      351\xe2\x94\x82         """\n      352\xe2\x94\x82         try:\n      353\xe2\x94\x82             obj, end = self.scan_once(s, idx)\n      354\xe2\x94\x82         except StopIteration as err:\n    \xe2\x86\x92 355\xe2\x94\x82             raise JSONDecodeError("Expecting value", s, err.value) from None\n      356\xe2\x94\x82         return obj, end\n      357\xe2\x94\x82 \nError: Process completed with exit …
Run Code Online (Sandbox Code Playgroud)

python github-actions python-poetry python-3.10

6
推荐指数
1
解决办法
2295
查看次数

如何在 Github Actions 上执行 MSI 文件(windows-latest runner)

语境

\n

我创建了一个 Github Actions 工作流程,生成.msi我不想稍后执行的文件,以测试应用程序是否按预期工作。

\n

工作流程实现如下

\n
build-windows:\n    runs-on: windows-latest\n    steps:\n      - uses: actions/checkout@v2.3.4\n      - name: Create binary from branch\n        run: |\n          choco install make\n          make build-windows\n      - name: Generate msi\n        shell: powershell\n        run: .\\.github\\scripts\\windows\\gen-win.ps1\n      - name: Install msi\n        run: |\n          echo "Start Msiexec"\n          msiexec /qn /i "file.msi" /L*vx!\n          echo "End Msiexec"\n
Run Code Online (Sandbox Code Playgroud)\n

基本上,此工作流程创建.exe文件(Create binary from branch步骤),然后使用 powershell 中的脚本生成.msi文件(Generate msi步骤),最后尝试安装.msi文件(Install msi步骤)。

\n
\n

问题 …

windows windows-installer github-actions powershell-cmdlet

5
推荐指数
1
解决办法
1320
查看次数

如何在 Github Actions macos 运行程序中签署和公证 PKG

语境

我正在构建一个 Github Actions 作业来构建、签名和公证PKG 文件。

我正在使用Apple ID 帐户(工作流程需要用户名和密码)以及带有私钥(加密)的开发人员 ID 安装程序证书。两者都保存为机密 (base64),并将在工作流程中转换为 .p12 文件,然后添加到钥匙串。

此作业是私有存储库中更大工作流程的一部分,该工作流程首先从软件生成文件(使用Pyinstaller),然后将 PKG 导出到 AWS S3 存储桶上。

实施情况

jobs:
  [...]

  pkg:
    needs: [...]
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Download macos bin file
        uses: actions/download-artifact@v2
        with:
          name: macos-bin-files
          path: dist/
      - name:
        run: | 
          ----- Create certificate files from secrets base64 -----
          echo ${{ secrets.DEVELOPER_ID_INSTALLER_CER }} | base64 --decode > certificate_installer.cer
          echo ${{ secrets.DEVELOPER_ID_INSTALLER_KEY }} …
Run Code Online (Sandbox Code Playgroud)

macos sign certificate notarize github-actions

5
推荐指数
1
解决办法
1826
查看次数

是否可以在 github 操作的 if 条件中进行模式匹配?

我目前正在这样做:

if: failure() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/mybranch')
Run Code Online (Sandbox Code Playgroud)

但我们正在使用 git flow(令我非常懊恼)。

如何检查分支名称是否包含特定模式?

像这样的东西:

if: failure() && ( !(github.ref ~= 'feature/*' )
Run Code Online (Sandbox Code Playgroud)

github github-actions

4
推荐指数
1
解决办法
3293
查看次数

gh 工作流程运行不适用于特定分支

我的仓库中有两个分支,即mainkaju1

main分支(默认)上,定义了两个工作流push.ymltest.yml

kaju1分支上,定义了push.ymltest.yml、 和三个工作流程pr.yml

我想使用 github cli 在分支pr.yml上触发 ie kaju1

我尝试使用这段代码:

gh workflow run --repo username/repo-name --ref kaju1 pr.yml
Run Code Online (Sandbox Code Playgroud)

但这返回给我以下错误:

HTTP 404: Not Found (https://api.github.com/repos/username/repo-name/actions/workflows/pr.yml)
Run Code Online (Sandbox Code Playgroud)

github-actions github-cli

1
推荐指数
1
解决办法
1601
查看次数