我的一些 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
我想在执行作业之前检查我的工作流程是否存在秘密。
像这样的东西:
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 工作流程中实现我想要的目标?
我正在尝试从另一个工作流程调用可重用工作流程,并向其传递一些输入变量。在调用者工作流程中,我有一些环境变量,我想将它们作为输入传递给可重用的工作流程,如下所示:
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 工作流程。我正在尝试使用这个工作流程:
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在本地更新文件,然后提交代码并将其推送到存储库时,第二个工作流程将触发。 …
poetry install自从我从 Python 3.8 迁移到 Python 3.10 以来,我在任何 GitHub 运行器上的 CI/CD 管道(Github Actions)中使用时都遇到问题。
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) 我创建了一个 Github Actions 工作流程,生成.msi我不想稍后执行的文件,以测试应用程序是否按预期工作。
工作流程实现如下
\nbuild-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"\nRun Code Online (Sandbox Code Playgroud)\n基本上,此工作流程创建.exe文件(Create binary from branch步骤),然后使用 powershell 中的脚本生成.msi文件(Generate msi步骤),最后尝试安装.msi文件(Install msi步骤)。
我正在构建一个 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) 我目前正在这样做:
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) 我的仓库中有两个分支,即main和kaju1,
在main分支(默认)上,定义了两个工作流push.yml和test.yml。
在kaju1分支上,定义了push.yml、test.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 ×10
certificate ×1
debian ×1
github ×1
github-cli ×1
go ×1
gofmt ×1
linter ×1
macos ×1
notarize ×1
python ×1
python-3.10 ×1
shell ×1
sign ×1
windows ×1