我正在尝试让私有 GitHub 操作在我的私有 GitHub 组织中工作。包含这些工作流程“模板”的私人存储库具有这个简单的文件结构,因为我只是试图让最低限度的工作:
\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .git\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 test\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 action.yml\nRun Code Online (Sandbox Code Playgroud)\n文件action.yml内容是:
name: Test\n\non: push\n\njobs:\n test:\n name: Test\n runs-on: ubuntu-latest\n steps:\n\n - name: Echo\n run: |\n echo Heyyyyy\nRun Code Online (Sandbox Code Playgroud)\n我正在尝试在另一个私有存储库中使用此操作,并使用包含以下内容的工作流程文件:
\nname: Test\n\non:\n push:\n branches:\n - master\n\njobs:\n test:\n name: Test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n with:\n repository: <private-actions-repo>\n token: ${{ secrets.REPO_TOKEN }}\n path: github-actions\n - name: Test private action\n uses: ./github-actions/test\nRun Code Online (Sandbox Code Playgroud)\n当此操作运行时,我收到以下错误:\n##[error]Top level 'runs:' section is required for /home/runner/work/<private-repo>/./github-actions/test/action.yaml
为了对此进行调试,我将使用模板的工作流程更新为该cat文件的文件内容: …
我有一个构建 yaml 文件,如下所示:
name: CI
on:
push:
branches:
- master
jobs:
BuildAndRelease:
strategy:
matrix:
BuildConfiguration:
- debug
- release
max-parallel: 2
runs-on: windows-2019
steps:
- name: List contents of a folder
run: dir
Run Code Online (Sandbox Code Playgroud)
如何在此步骤中添加条件?
if: and(succeeded(), eq(variables['BuildConfiguration'], 'debug'))
我有一堆使用 Azure Pipelines 进行 CI/CD 的存储库,我现在正在尝试将其移植到 Github Actions。这是我正在研究的第一个:https://github.com/Azure/AzureAuth/tree/fix-ghaction
我已经完成了 99% 的工作,但在某一步骤中我遇到了奇怪的身份验证错误。该存储库已镜像到另一个组织(cloudyr),我使用此步骤进行镜像:
- name: Copy to Cloudyr
if: runner.os == 'Linux'
env:
token: "${{ secrets.ghPat }}"
run: |
export CLOUDYR_REPO=$(echo $GITHUB_REPOSITORY | sed "s/Azure/cloudyr/")
git push --prune https://$token@github.com/${CLOUDYR_REPO}.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
Run Code Online (Sandbox Code Playgroud)
这会从存储库机密中检索 PAT,并执行git push. 它与 Azure Pipelines 完美配合,但现在失败并出现以下错误:
Run export CLOUDYR_REPO=$(echo $GITHUB_REPOSITORY | sed "s/Azure/cloudyr/")
remote: Permission to cloudyr/AzureAuth.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/cloudyr/AzureAuth.git/': The requested URL returned error: 403
Error: Process completed with exit code …Run Code Online (Sandbox Code Playgroud) 我有一个像blow这样的workflow_dispatch触发器:
我需要定义验证,以便 logLevel 必须在特定的值集中['info', 'warning', 'error']
我知道我可以执行 bash if 命令并检查值。但我宁愿不这样做。
有内置的方法可以做到这一点吗?
name: MoneyTracker Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependency
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8
- name: Coverage report
env:
secret_key: ${{secrets.SECRET_KEY}}
debug: ${{secrets.DEBUG}}
db: ${{secrets.DB}}
run: |
pip install coverage
coverage run MoneyTracker/manage.py test
coverage report …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置一个 github 操作机器人,该机器人在操作运行时使用合成来构建。值得注意的是,这不是必需的,而且我知道 ncc 也会实现同样的目标,但我很好奇是否有可能以可持续的方式实现这项工作。
对于某些上下文,我正在尝试使用 yaml 脚本运行我的alita-moore/EIP-Bot私人操作...
name: "Auto Merge EIP"
description: "A bot that lints EIP edits, finds common errors, and can auto-merge"
inputs:
GITHUB-TOKEN:
description: |-
The Github token to be used by this bot when merging, posting comments, or requesting reviewers
required: true
VERSION:
description: version of the action; this is required because of how actions work
required: true
runs:
using: "composite"
steps:
- run: cd /home/runner/work/_actions/alita-moore/EIP-Bot/${{ inputs.VERSION }} && npm ci && npm run …Run Code Online (Sandbox Code Playgroud) 我有一个 PR,我希望在合并到 master 之前完成某些检查。这是工作 https://github.com/hhimanshu/typescript-serverless-api-vercel/actions/runs/763599870
现在,在 PR 中,没有报告其状态。这是公关
https://github.com/hhimanshu/typescript-serverless-api-vercel/pull/4
我在https://github.community/t/expected-waiting-for-status-to-be-reported/18001上查看了过去提出的类似问题,但是,该问题中出现此问题的原因是
在大多数情况下,这是因为您从工作流程中删除了作业或更改了作业(重命名),但没有更新分支规则。
但就我而言,作业名称相同,并且作业也没有被删除,因此该解决方案不适用。
有人可以帮我理解我在这里做错了什么吗?
这是我的动作脚本:
name: Build
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: |
whoami
sudo mkdir /first_org
sudo chmod -R 777 /first_org
cd /first_org
git clone https://github.com/first_org/site
sudo rm -rf /first_org/site/.git
sudo mkdir /second_org
sudo chmod -R 777 /second_org
cd /second_org
git clone https://github.com/second_org/site
cp -a /first_org/site/. /second_org/site
cd /second_org/site
sudo apt-get update
sudo apt install nodejs
npm build
Run Code Online (Sandbox Code Playgroud)
这/first_org/site是一个公共回购,但这/second_org/site是一个私人回购。
我不使用action/checkout@v2,因为它不允许我们指定要克隆到的绝对路径。因此我不得不使用纯 shell 命令。
这个动作属于/second_org/site回购协议,因此基于文档,我可以用来 …
我遇到一个仅在我的 Github Actions 工作流程中发生的错误(当我在本地运行 Jest 脚本时,没有问题)。我只找到了这个答案和这个答案,但错误仍然存在。关于下一步要检查什么有什么想法吗?
\n这是错误:
\n> jest server/test/test --config=server/test/jest.config.js\n\nFAIL server/test/test.js\n \xe2\x97\x8f Test suite failed to run\n\n ReferenceError: TextEncoder is not defined\n\n at Object.<anonymous> (../../node_modules/mongodb-connection-string-url/node_modules/whatwg-url/dist/encoding.js:2:21)\n at Object.<anonymous> (../../node_modules/mongodb-connection-string-url/node_modules/whatwg-url/dist/url-state-machine.js:5:34)\nRun Code Online (Sandbox Code Playgroud)\n这是我的 Jest 配置和脚本:
\n笑话配置.js
\nmodule.exports = {\n preset: \'@shelf/jest-mongodb\'\n};\nRun Code Online (Sandbox Code Playgroud)\n测试.js
\nconst dotenv = require(\'dotenv\');\nconst path = require(\'path\');\nprocess.env = dotenv.config({path: path.resolve(__dirname, \'.env\')}).parsed;\n\nconst request = require(\'supertest\');\nconst {app, server} = require(\'../server\');\nconst { MongoClient } = require(\'mongodb\');\nconst { TextEncoder } = require(\'util\');\n\nglobal.TextEncoder = TextEncoder;\n\ndescribe(\'GET …Run Code Online (Sandbox Code Playgroud) 我有项目,目前 rubocop 检查通过(我有 rubocop_todo.yml)。我正在尝试自己在 Github Actions 中设置 linter 阶段(没有第三方操作来运行 rubocop,该操作已经存在),并且由于某种原因 rubocop 没有通过那里:
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that you can opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # new in 1.10
Enabled: true
Layout/LineEndStringConcatenationIndentation: # new in 1.18
Enabled: true
Layout/SpaceBeforeBrackets: # new in 1.7
Enabled: true
Lint/AmbiguousAssignment: # new …Run Code Online (Sandbox Code Playgroud)