我们的 GitHub 组织是私有的,并且正在我们组织的多个不同存储库中开发多个私有 R 包。其中一些包依赖于我们私有组织中的其他存储库。如何设置 GitHub 操作以安装这些私有依赖项?我的描述文件目前包含:
Imports:
MyPackageDep
Remotes:
MyOrg/MyPackageDep
Run Code Online (Sandbox Code Playgroud)
我的 GitHub 操作的相关部分.yaml是:
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
Run Code Online (Sandbox Code Playgroud)
我尝试通过将我的 PAT 存储在一个文件中来遵循这篇 SO 帖子的建议.Renviron。但这不仅仍然不起作用,我仍然不确定这将如何与包的多个贡献者一起工作。请问他们都只是需要建立自己的地方GITHUB_PAT自己.Renviron?
我还尝试通过在我的 GitHub 工作流程中包含以下内容来遵循此GitHub 问题的建议:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Run Code Online (Sandbox Code Playgroud)
工作流仍然无法下载依赖项。
无论如何,GitHub Secrets 是否可以预先配置存储库以访问组织中的所有其他私有存储库?
我有一些非常昂贵的基准/测试,我只想在一些 PR 上运行,而不是全部。有没有办法通过 github actions 来做到这一点?
continuous-integration github github-actions building-github-actions
我们有一些操作可以逻辑地分组到一个工作流程中,但并非所有操作都需要始终运行。
我知道
on:
push:
paths:
- 'docs/**'
Run Code Online (Sandbox Code Playgroud)
有没有办法将这些信息应用于特定的工作或步骤?
这是我目前在 GitHub 上使用的工作流程
name: Windows10 - CI
on: [ push ]
jobs:
run-test:
runs-on: [ self-hosted, windows, DO ]
steps:
- uses: actions/checkout@v2
with:
clean: false
- name: Run nds2 CI - Sanity Test
if: github.ref == 'refs/heads/master'
run: cd c:\actions-runner\_work\nds2\nds2 ; python3 ci_host.py --master
- name: Run nds2 CI - Build Installer
if: github.ref != 'refs/heads/master'
run: cd c:\actions-runner\_work\nds2\nds2 ; python3 ci_host.py
Run Code Online (Sandbox Code Playgroud)
我有一台 Windows 10 计算机,它使用 GitHub 运行程序侦听传入的作业。在传入作业时,如果向 master 分支进行推送,则脚本 ci_host.py 将使用“--master”标志运行,该标志会启动虚拟机并对其运行多个测试。最终,在测试结束时,脚本将虚拟机恢复到预先配置的快照。
所以基本上我想要实现的是,当通过 GitHub actions Web 界面取消作业时,处理测试的脚本将在作业中被取消,并且没有机会将虚拟机恢复到之前的状态干净状态(快照)。
即使作业被取消,如何运行将在工作流程结束时运行的脚本?因此,无论发生什么情况,我的虚拟机都可以恢复到干净的状态
在此先感谢您的帮助 …
这是我返回的操作,$TOXENV看起来像这样,py3.6-django2.2我希望$TOXENV看起来像这样,而py36-django22不是有任何替代/替换函数可以用来替换.char 吗?
name: CI
on:
workflow_dispatch:
branches: [ master, actions ]
jobs:
demo:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
django: ['2.2', '3.0']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
name: Set up Python ${{ matrix.python }} ${{ matrix.django }}
with:
python-version: ${{ matrix.python }}
- name: python version
env:
TOXENV: "py${{ matrix.python }}-django${{ matrix.django }}"
run:
echo $TOXENV
Run Code Online (Sandbox Code Playgroud) 我发现了一个非常好的 GitHub Actions 功能,名为“环境”。使用适当的语法,也可以在 GitHub Action 中创建环境,workflow.yml如下所示:
environment:
name: test_environment
url: https://your-apps-url-here.com
Run Code Online (Sandbox Code Playgroud)
正如文档所述,这是创建 GitHub 操作环境的有效方法:
运行引用不存在的环境的工作流将创建具有引用名称的环境。
但在我当前的 GitHub Action 工作流程中,有没有一种方法可以url根据部署步骤输出动态设置?我有一个由 AWS 部署过程产生的动态 URL,我无法预先定义它。
直到昨天,Github Actions 还在我的存储库中工作。我没有在 .github/workflows/dev.yml 文件或 DockerFile 中做任何更改。
但是,突然在最近的推送中,我的 Github Actions 因错误而失败
设置、构建、发布和部署
Run Code Online (Sandbox Code Playgroud)Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/_actions/GoogleCloudPlatform/github-actions/master/setup-gcloud'. Did you forget to run actions/checkout before running your local action?
我可以知道如何解决这个问题吗
这是我正在使用的示例 .yml 文件。
name: Release to Development
on:
push:
branches:
- 'master'
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '270.0.0'
service_account_email: ${{ secrets.GCLOUD_EMAIL_DEV }}
service_account_key: ${{ secrets.GCLOUD_AUTH_DEV }}
# Configure …Run Code Online (Sandbox Code Playgroud) 下面是我的 GitHub 工作流程
name: APP Build
on:
push:
branches:
- feature/test
jobs:
test-1:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && contains( github.event.head_commit.message, 'test1') }}
steps:
- name: test-fail
run: echo "test1"
test-2:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && contains( github.event.head_commit.message, 'test2') }}
steps:
- name: test-fail
run: echo "test1"
notify-slack:
name: Slack Notification
runs-on: ubuntu-latest
needs: [test-1, test-2]
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2.2.0
env:
SLACK_CHANNEL: alert
SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用官方 GitHub 缓存操作(https://github.com/actions/cache)来缓存一些二进制文件以加快我的一些工作流程,但是在指定多个时我无法让它工作缓存路径。
这是我使用单个缓存路径设置的一个简单的工作测试:有一个用于写入缓存的操作,一个用于读取缓存的操作(两者都在单独的工作流程中执行,但在同一存储库和分支上)。首先执行写入操作,并创建一个文件“subdir/a.txt”,然后使用“actions/cache@v2”操作对其进行缓存:
# Test with single path
- name: Create file
shell: bash
run: |
mkdir subdir
cd subdir
printf '%s' "Lorem ipsum" >> a.txt
- name: Write cache (Single path)
uses: actions/cache@v2
with:
path: "D:/a/cache_test/cache_test/**/*.txt"
key: test-cache-single-path
Run Code Online (Sandbox Code Playgroud)
读取操作检索缓存,递归打印目录中所有文件的列表,以确认已从缓存中恢复文件,然后打印缓存的 txt 文件的内容:
- name: Get cached file
uses: actions/cache@v2
id: get-cache
with:
path: "D:/a/cache_test/cache_test/**/*.txt"
key: test-cache-single-path
- name: Print files
shell: bash
run: |
echo "Cache hit: ${{steps.get-cache.outputs.cache-hit}}"
cd "D:/a/cache_test/cache_test"
ls -R
cat "D:/a/cache_test/cache_test/subdir/a.txt"
Run Code Online (Sandbox Code Playgroud)
这可以正常工作,没有任何问题。
现在,缓存操作的描述包含指定多个缓存路径的示例:
- …Run Code Online (Sandbox Code Playgroud) 我已经使用触发器创建了可重用工作流程workflow_call,但我需要根据其结果运行其他步骤。
例子:
jobs:
released:
steps:
- name: Build
uses: my-org/some-repo/.github/workflows/build.yml@main
- name: Upload source maps
run: something
Run Code Online (Sandbox Code Playgroud)
可重用的构建步骤构建我的 JS 应用程序并生成源映射。现在,我需要将这些源映射作为单独的步骤上传到某个位置,该步骤应该仅在此已发布的作业中运行。
执行上述操作会导致以下错误:
错误:.github#L1
可重用工作流程应在顶级“jobs.*.uses”键引用,而不是在步骤内引用
它只允许在作业中运行我的可重用工作流程,而不是在步骤中运行。但这样做我就无法再访问源映射了。
我的问题:如何重用构建工作流程中的步骤并在已发布作业中访问其输出?
github-actions ×10
github ×6
yaml ×2
caching ×1
docker ×1
environment ×1
git ×1
r ×1
windows ×1
workflow ×1