I\xe2\x80\x99d 喜欢在其中考虑公共路径:
\n\non:\n push:\n # Run only on changes on these files\n paths:\n - \'lib/**.nim\'\n - \'doc/**.rst\'\n - \'doc/nimdoc.css\'\n - \'.github/workflows/ci_docs.yml\'\n\n pull_request:\n # Run only on changes on these files\n paths:\n - \'lib/**.nim\'\n - \'doc/**.rst\'\n - \'.github/workflows/ci_docs.yml\'\nRun Code Online (Sandbox Code Playgroud)\n\ngithub 上的文档提到了[push, pull_request],但如果我们有路径节点,它就不会\xe2\x80\x99 工作。避免代码重复的语法是什么?
(提前为与https://github.community/t/how-to-factor-paths-in-common-for-push-and-pull-request/115967的交叉发帖道歉,如果我得到任何答案,我\'将在另一端更新)
\nnpm ci这是我在 GitHub 操作文件中运行命令时遇到的问题。
Run npm ci
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/------
npm ERR!
npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.113.4' to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited …Run Code Online (Sandbox Code Playgroud) 在 Github 操作运行器上运行时,Maven 日志输出仅显示 3 个星号 ( ***) 而不是实际字符串
警告:/home/runner/work/project/src/test/java/de/***/persistence/dao/DaoTest.java:98:更喜欢 java.time.ZonedDateTime
这些从哪里来***?
目前,我的存储库中有两个用于“发布 GitHub 页面”的工作流程。
一个是我自己制作的“Build GitHub Pages”,“pages-build-deployment”是由 GitHub 注册用于 GitHub Page 发布的。

我不喜欢这个。我希望这两个工作流程合并为一个。
有两个原因。
首先,“pages-build-deployment”运行两次。第一个被取消,第二个正常运行。那是因为我修改了“gh-pages”分支的文件来美化文件。这会触发“pages-build-deployment”运行两次。我不想要这样。这使得工作流日志对于一次提交具有三个条目。是的,这是个人喜好。
其次,我想查看发布 GitHub Pages 的完整状态。即使“构建 GitHub 页面”操作成功,我也必须等待“pages-build-deployment”完成其工作才能运行实际页面。
所以,我写了这样的工作流程文件。
name: Build GitHub Pages
on:
push:
branches:
- main
jobs:
build:
name: Build GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout latest commit
uses: actions/checkout@v3
- name: Prepare Python
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install requirements (mkdocs-material)
run: |
echo "Installing mkdocs-material"
pip install mkdocs-material
echo "Installing js-beautify"
npm install -g --location=global js-beautify --no-fund
- name: Build …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个如下所示的工作流程,其中矩阵不仅仅包含一项作业,而是包含多个作业,对于我们想要构建、测试和部署的每个环境。
如果环境中的某个步骤失败,则不应运行该环境的后续步骤。
矩阵就像["Env A", "Env B", ... , "Env n"]
有没有其他方法可以在不重复代码的情况下做到这一点?
您好,我正在 GitHub 操作期间使用curl 将提交消息发送到通知中的 webhook 触发器。
curl -H 'Content-Type:application/json' -d '{ "commit":"${{github.event.head_commit.message}}",...}'
Run Code Online (Sandbox Code Playgroud)
它不适用于提交的消息,包括",例如,如果提交的消息是:feat(#7): replace "FAQ" by "Help Center"
GitHub Action 将尝试以这种方式执行curl:
curl -H 'Content-Type:application/json' -d '{ "commit":"feat(#7): replace "FAQ" by "Help Center"",...}'
Run Code Online (Sandbox Code Playgroud)
结果出现错误...
我试图用以下代码转义双引号:
- run: echo "GITHUB_COMMIT=$(echo ${{github.event.head_commit.message}} | sed 's/"/\\"/g')" >> $GITHUB_ENV
Run Code Online (Sandbox Code Playgroud)
但 Github Action 在执行过程中再次替换了我的deploy.yml 中的“字面意思”值:
Run echo "GITHUB_COMMIT=$(echo feat(#7): replace "FAQ" by "Help Center" | sed 's/"/\\"/g')" >> $GITHUB_ENV
/home/runner/work/_temp/1e27e232-c415-42e0-8ab8-88bb836a0c08.sh: line 1: unexpected EOF while looking for matching `)'
Error: Process completed with …Run Code Online (Sandbox Code Playgroud) 除了成功和失败之外,Github Actions 是否还有警告状态?如何为不属于我的操作设置一个?例如,Github Actions 返回代码 1(错误),在这种情况下我只想将其视为警告,而不是错误。
我正在尝试将一个简单的 Web Api 应用程序部署到 Azure,以帮助我熟悉 Azure 服务和用于部署的 Github Actions。以下是我已采取的步骤
1 - 在 Visual Studio 中创建一个新的 .NET 7 Web Api 应用程序。这将创建一个样板 Weatherforecast API 应用程序,并通过 VS 在本地按预期运行。2- 创建一个新的 github 存储库并将我的 .sln 文件连同项目文件夹发布到该存储库
在蔚蓝中:
在我的主资源组中创建新的 Web 应用程序服务
在创建过程中链接到我的 github 帐户并选择我的项目文件夹和 .sln 文件所在的存储库和主分支。
现在,工作流文件已在存储库中创建,部署将启动,但几分钟后失败并出现错误:
构建解决方案时不支持“--output”选项。
如果工作流程文件如下,我看不到如何禁用此选项:
name: Build and deploy ASP.Net Core app to Azure Web App - muzztest
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x' …Run Code Online (Sandbox Code Playgroud) 我正在使用 github actions 将项目发布到 github 页面,这是 yml 文件:
name: Pages
on:
push:
branches:
- main # default branch
jobs:
pages:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
# If your repository depends on submodule, please see: https://github.com/actions/checkout
submodules: false
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Install Dependencies
run: …Run Code Online (Sandbox Code Playgroud) 创建了一个 github 操作,用于为arm64平台构建docker镜像以快速构建它(无模拟)我使用macos-latest-xlargearm64机器
github操作代码示例如下:
name: Mac OS Issue
on:
workflow_dispatch:
jobs:
macos_issue:
name: Check Issue
runs-on: macos-latest-xlarge
steps:
- name: Check Issue
id: check_issue
run: |
set +e
brew install docker docker-buildx
docker --version
echo "FROM ubuntu:latest" > Dockerfile
docker build --no-cache -t test .
Run Code Online (Sandbox Code Playgroud)
运行时失败并出现以下错误
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Run Code Online (Sandbox Code Playgroud)
我尝试使用 macos-latest 进行模拟,但速度非常慢。所以一定是arm64机器
github-actions ×10
github ×3
.net-core ×1
azure ×1
docker ×1
dockerfile ×1
escaping ×1
expo ×1
github-pages ×1
macos ×1
path ×1
pull-request ×1
yaml ×1