我有一个 Azure 存储帐户。当我允许所有网络访问时,我的 Github 操作可以运行和更新我的 Azure 静态网站。
当我禁止除命名网络(147.243.0.0/16 和我的机器的 IP)之外的所有网络时,我在 Github Actions 中收到 403(请求被拒绝)错误。
我假设我需要将 GitHub 添加到这些 IP,但是当我运行时:
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/meta
Run Code Online (Sandbox Code Playgroud)
有大量的IP!我需要将它们全部添加吗?
我正在将 Github Actions 用于我的存储库之一,并使用以下工作流程 .yml 文件:
\nname: Minify source files\n\non: [push]\n\njobs:\n read:\n runs-on: ubuntu-18.04\n \n steps:\n - name: Copy files\n run: cp src/Javascript/syntax.js out\n - name: Copy files\n run: cp src/CSS/syntax.css out\n - name: Checkout\n uses: actions/checkout@v2\n - name: minisauras\n uses: TeamTigers/minisauras@v2.0.0\n env:\n GITHUB_TOKEN: ${{ secrets.MINIFIER }}\n id: dir\n with:\n directory: 'out/'\nRun Code Online (Sandbox Code Playgroud)\n该操作应该从文件夹“src/Javascript”和“src/CSS”复制名为“syntax.js”和“syntax.css”的文件。运行该操作时,我收到错误:
\ncp: cannot stat 'src/Javascript/syntax.js': No such file or directory\nRun Code Online (Sandbox Code Playgroud)\n这是我的项目结构:
\nRepository\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .github/workflows\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main.yml\n\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 CSS\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 syntax.css\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Javascript \n …Run Code Online (Sandbox Code Playgroud) 在我的 Django 项目中,我有一个用于运行测试的 CI 工作流程,这需要 Postgres 服务。最近,一个新的应用程序引入了更重的软件包,例如 pandas、matplotlib、pytorch 等,这将run-tests工作时间从 2 分钟增加到了 12 分钟,这是荒谬的。另外,在我的项目中,我有一个带有 Python 的基本 Docker 映像,以及这些较重的包,可以加快映像的构建速度。因此,我考虑在运行步骤时在工作流程中使用相同的图像,因为包已经加载。
不幸的是,一切都很顺利,直到到达实际运行测试的步骤,因为 postgres 服务似乎未与容器连接,并且出现以下错误:
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
这就是我现在的工作流程。关于我做错了什么有什么想法吗?
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud) 我想在某些分支上排除构建矩阵的某些部分。从概念上讲,类似于以下内容,但它不起作用,因为branches它不是矩阵变量。
name: Tests
on:
pull_request:
push:
branches: [hackage, develop]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
resolver: [lts-3.22 , lts-17, lts-18, lts, nightly]
exclude:
- branches: [hackage]
resolver: [nightly, lts]
Run Code Online (Sandbox Code Playgroud)
有没有办法以惯用的方式做到这一点。在这里,例如在分支上排除nightly和lts解析器hackage?
我创建了一个管道,并且需要向特定用户发送有关该过程结果的自动电子邮件。是否有经过验证的操作可以使用 github 操作发送电子邮件。我已经在市场上看到了一些行动,但不幸的是这些行动尚未得到验证。
当我从 github 发布它时,我需要更新 package.json 文件中的版本号。有没有什么方法可以将新创建的标签版本设置为 package.json 中的版本号
我已经浏览了 Github Rest API v3 和 Github GraphQL API v4,但我无法找到资源/端点来检查 dependentabot 是否通过 API 启用?我已经阅读了大量文档,但找不到任何有用的内容。有人可以指出我正确的文档或告诉我要使用哪个资源吗?谢谢!
我试图找到 GitHub Action 中一个分支与另一个分支分离的提交的 SHA。
在本地,我可以通过运行来实现这一点git merge-base <commit> <commit>。我正在尝试在工作流程中实现相同的目标。
我有以下内容workflow.yaml:
name: "Find common ancestor"
on:
pull_request:
branches:
- master
jobs:
find:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Find common ancestor
run: git merge-base "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF"
Run Code Online (Sandbox Code Playgroud)
当工作流在打开分支“dev”到“master”的拉取请求时运行时,工作流会报告以下错误:
2021-08-14T19:17:04.5732118Z fatal: Not a valid object name dev
Run Code Online (Sandbox Code Playgroud)
我所有的研究都表明需要设置获取深度。据我了解,如果不将 fetch-depth 设置为 0,则只会获取浅克隆。不幸的是,即使将 fetch-depth 设置为 0,工作流程也无法找到必要的引用,而且我也没有想法。
有谁知道为什么 merge-base 无法识别引用,或者知道寻找共同祖先的替代方法?
编辑:
运行时git branch -a,我发现 refs 前面带有remote/origin/*,这解释了为什么在调用时找不到它们merge-base。为什么我退房后无法访问当地分行?
以下 GitHub Pylint 入门工作流程失败并出现大量pylintF0001 错误。
这是 github-workflow源代码:
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint `ls -R|grep .py$|xargs`
Run Code Online (Sandbox Code Playgroud)
这些是工作流程输出的错误:
Run pylint $(ls -R | grep '.py$' | xargs)
************* Module __init__.py
__init__.py:1:0: F0001: No module named __init__.py …Run Code Online (Sandbox Code Playgroud) 我在 GitHub 企业存储库上使用语义版本操作。直到最近它都工作正常,但开始因此错误而失败
Error: Command failed: npm ci --only=prod
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-23T10_41_00_344Z-debug.log
at ChildProcess.exithandler (child_process.js:295:12)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
killed: false,
code: 1,
signal: null,
cmd: 'npm ci --only=prod',
stdout: '',
stderr: 'npm ERR! code E401\n' +
'npm ERR! Unable to authenticate, need: Basic realm="GitHub …Run Code Online (Sandbox Code Playgroud) github-actions ×10
github ×6
npm ×2
action ×1
automation ×1
azure ×1
devops ×1
git ×1
github-api ×1
grep ×1
ip ×1
javascript ×1
npm-install ×1
postgresql ×1
pylint ×1
python-3.x ×1
version ×1