标签: github-actions

在我的 Github Action 工作流程完成后,如何运行 GitHub Webhook?

目前,我的 GitHub Webhook 设置为每次主分支上发生推送时部署我的网站。现在,有了用于 CI 的 GitHub Actions,我只想在 GitHub 上的 CI 成功时运行此 Webhook。

我是否可以告诉我的 GitHub Webhook 等待 GitHub 的 CI ,或者我不应该再使用 Webhook,而是在 GitHub 工作流程中管理此行为?

git continuous-integration github github-api github-actions

5
推荐指数
1
解决办法
2877
查看次数

从 Github Actions 发布 Maven

我想知道我们是否可以在关闭里程碑后使用 Github Actions 来提交发布。

mvn release:prepare && mvn release:perform所以我之前所做的就是在本地计算机上提交,然后推送它。然而,通过 Github Actions,我希望能够从工作流程本身自动执行发布提交。

到目前为止,所有使用 Maven 和 Github Actions 的教程都仅限于运行clean install或测试检查或部署,但从未发布。

有人有使用 Github Actions 设置 Maven 版本的经验吗?谢谢

github maven maven-release-plugin github-actions

5
推荐指数
1
解决办法
7627
查看次数

github actions 共享工作区(yml 配置)

如果我可以运行如下所示的工作流程,那就太酷了 - 也许我只是缺少 GitHub 操作中的简单配置,但我不知道如何在作业之间共享工作区,同时用于指定job.needs哪些作业可以运行当其他人已经成功完成时。

name: Node CI

on: [push]
env:
  CI: true

jobs:
  install:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: install node_modules
      run: yarn install

  lint:
    runs-on: ubuntu-latest
    needs: [install]
    steps:
      - name: eslint
        run: yarn lint

  build:
    needs: [install]
    runs-on: ubuntu-latest
    steps:
      - name: yarn build
        run: yarn build

  test:
    needs: [install, build]
    runs-on: ubuntu-latest
    steps: …
Run Code Online (Sandbox Code Playgroud)

continuous-integration github github-actions

5
推荐指数
1
解决办法
1829
查看次数

如何在 github 操作中获取拉取请求中的文件列表

我正在尝试设置一个 github 操作,该操作将根据更改中的文件名称自动请求审阅者。例如,如果差异包含一个*.sql文件,我想请求特定人员进行审核,对于其他文件扩展名也是如此。

我开始在市场上执行此操作: https: //github.com/marketplace/actions/auto-assign-action。我认为最好的方法是使用条件,例如:

name: 'DB Review'
on: pull_request

jobs:
  add-reviews:
    runs-on: ubuntu-latest
    steps:
      - uses: kentaro-m/auto-assign-action@v1.0.1
        if: "{{ contains(github.files, '.sql') }}"
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
Run Code Online (Sandbox Code Playgroud)

不幸的是,这个神奇的差异列表似乎不存在:https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for- github-actions#github-context,所以我希望得到一些其他建议。

github github-actions

5
推荐指数
1
解决办法
1万
查看次数

如何在Github Action中获取Python包版本?

我有一个构建 Windows 轮子的 Github Action。在构建结束时,它会安装轮子以确保一切正常,但现在版本已硬编码在文件名中。我看到这个问题涉及发布,但我想在每次推送到 master 时运行它来检查一切是否正常。

现在我的操作中有一行看起来像这样:

pip install "fugashi-0.1.9rc1-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
Run Code Online (Sandbox Code Playgroud)

我不想每次版本更改时都更新操作,所以我希望该行看起来像这样:

pip install "fugashi-$VERSION-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
Run Code Online (Sandbox Code Playgroud)

但我不知道如何将版本放入github操作的环境中。

有什么方法可以从环境变量中的 setup.py 获取作业的版本号吗?

python github-actions

5
推荐指数
1
解决办法
1736
查看次数

GitHub Actions download-artifact 是否创建存档或文件夹结构?

我正在使用 GitHub Actions,有 2 项工作,一项用于上传文件夹,另一项将使用该文件夹创建图像。

工作一:

- name: Upload Build
  uses: actions/upload-artifact@v1
    with:
      name: StandaloneLinux64
      path: build/StandaloneLinux64
Run Code Online (Sandbox Code Playgroud)

工作2:

- uses: actions/download-artifact@v1
  with:
    name: StandaloneLinux64
    path: Docker/StandaloneLinux64
Run Code Online (Sandbox Code Playgroud)

这会添加存档 (zip/tar/tar.gz) 还是会重新创建文件夹结构?我查看了文档,但找不到明确的地方。

github artifact github-actions

5
推荐指数
1
解决办法
6651
查看次数

Github Actions 和 git clone 问题

在 Github Actions 中使用 git clone 时遇到一些问题,无论我尝试什么,我都会得到以下信息:

我的 main.yml 中失败的代码:

jobs:
 terraform:
   name: 'Terraform with Github Actions!'
   runs-on: ubuntu-latest
   steps:
   - name: 'Login to Azure'
    uses: azure/login@v1
    with:
      creds: ${{ secrets.AZURE_CREDENTIALS }}
  - name: 'Checkout'
    uses: actions/checkout@master
  - name: 'Preparing blueprint-environment'
    run: |
      snip
      git clone git@github.com:ourcompany/whateverrepo.git
Run Code Online (Sandbox Code Playgroud)

错误信息:

git@github.com:权限被拒绝(公钥)。

我看过很多关于添加 ssh 密钥的帖子,但那是本地的,而不是在从 Github 操作运行的 ubuntu 版本中 - 我在这里缺少什么?我无法生成 ssh 密钥并将私钥动态添加到 Github 存储库设置,我该如何解决此问题?

terraform github-actions

5
推荐指数
1
解决办法
1万
查看次数

在 Github Actions 中部署 Firebase 会出现授权失败错误

我正在尝试使用 github 操作自动将 React 应用程序部署到 firebase,但出现以下错误:

Error: Autorization failed. This account is missing the following required permissions on project ***
 firebase.projects.get
 firebasehosting.sites.update
Run Code Online (Sandbox Code Playgroud)

我有多个站点,当我尝试使用它手动部署时,firebase deploy --only hosting:MY_SITE_NAME它工作正常。我的工作流程中有两份工作。构建作业通过,但部署作业失败。这是我的工作流程文件:

name: Build and Deploy to Firebase
on:
  push:
    branches:
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: yarn install
      - name: Build
        run: yarn build
      - name: Archive Production Artifact
        uses: actions/upload-artifact@master
        with:
          name: build
          path: build
  deploy:
    name: Deploy …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-cli github-actions

5
推荐指数
1
解决办法
8349
查看次数

在 Github Actions 中克隆私有存储库

我正在尝试在 Github actions 中克隆另一个私有仓库。我已经设置SECRET_USERSECRET_PASSWORD在存储库的秘密中运行操作。在操作中我正在运行命令

git clone https://$SECRET_USER:$SECRET_PASSWORD@github.com/other-organization/other-repo.git
Run Code Online (Sandbox Code Playgroud)

但出现错误

Cloning into 'other-repo'...
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/other-organization/other-repo.git/'
##[error]Process completed with exit code 128.
Run Code Online (Sandbox Code Playgroud)

在 Github Actions 中,尽管我已经验证用户可以访问https://github.com/other-organization/other-repo(这显然不是内部存储库的真实 URL)。

git github github-actions

5
推荐指数
1
解决办法
5719
查看次数

commitlint config-conventional - 为提交消息添加前缀

我正在尝试为我的一个存储库实现commitlint,以便所有提交消息都是标准的。但是,我们要求添加 JIRA ID 作为前缀的一部分。

目前,commitlint 格式如下

subject(scope): message 
Run Code Online (Sandbox Code Playgroud)

我需要如下所述

JIRA-ID: subject(scope): message 
Run Code Online (Sandbox Code Playgroud)

以下作品

parserPreset: {
    parserOpts: {
         issuePrefixes: ['w{2,4}-[0.9]{2,4}']
    }
}
Run Code Online (Sandbox Code Playgroud)

但是它验证 JIRA id 应该位于末尾。像下面的东西

subject(scope): message JIRA-ID
Run Code Online (Sandbox Code Playgroud)

git github node.js github-actions

5
推荐指数
1
解决办法
2687
查看次数