标签: github-actions

如何检查最后 2 个推送提交之间的差异

因此,我有一个 GitHub 工作流程,它在推送时运行并检查特定目录中的更改,并在有更改时运行脚本。然而,对于当前的实现 ( git diff HEAD^ HEAD),它仅检查最后 2 次提交之间的差异。完全有可能推送超过 1 个提交,因此我正在寻找一种方法来比较最后 2 个推送的提交。

如果有人能帮助我,那就太好了!

github git-diff github-actions

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

错误 NU***0***:无法找到包 <packageId>。源中不存在具有此 id 的包:github、nuget.org

使用公共 NUGET.ORG 包以及我的组织自己的 nuget Github Packages 注册表中的包的项目可以在本地正常恢复,但无法在 Github Action 中执行此操作。以下是操作 yml 的摘录:

name: workflow1

on:
  push:
    branches: [ main ]

jobs:

  build:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: write
      packages: write
      issues: write

    steps:
      - name: Check that shit out
        uses: actions/checkout@v3
      
      - name: Set that shit up
        uses: actions/setup-dotnet@v2
        with:
          dotnet-version: '6.x.x'

      - name: Build that shit
        run: |
          dotnet nuget add source https://nuget.pkg.github.com/myorg/index.json -n github -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
          dotnet restore ./project.sln
          dotnet …
Run Code Online (Sandbox Code Playgroud)

.net nuget github-actions github-package-registry

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

npm install private github repo github actions

I have a nodejs project that uses a private git repo as one of it's dependencies. It's defined in package.json like this:

"repo name": "git+https://{access_token}@github.com/{owner}/{repo name}.git#master"

My workflow file looks like this:

name: Tests

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - name: Install modules
        run: npm ci
      - name: Run tests
        run: npm test
Run Code Online (Sandbox Code Playgroud)

npm ci however fails with npm ERR! remote: Repository not found.

Using npm ci on my …

git github node.js npm github-actions

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

在非交互式环境中更新 Keystone 项目的 Prisma、GraphQL 和数据库架构

我正在构建一个正在部署 keystone.js 服务器的 github 操作事件

\n

构建运行时,系统会提示用户回答问题

\n
\xe2\x9e\x9c  server git:(test-me) npm run build\n\n> keystone-app@1.0.0 build\n> keystone build\n\nYour Prisma and GraphQL schemas are not up to date\n\xe2\x9c\x94 Would you like to update your Prisma and GraphQL schemas? \xe2\x80\xa6 no\n
Run Code Online (Sandbox Code Playgroud)\n

我的问题是如何配置工作流程,以便在运行时它会回答“是”?

\n

谢谢!

\n

keystonejs github-actions

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

gh 工作流程运行不适用于特定分支

我的仓库中有两个分支,即mainkaju1

main分支(默认)上,定义了两个工作流push.ymltest.yml

kaju1分支上,定义了push.ymltest.yml、 和三个工作流程pr.yml

我想使用 github cli 在分支pr.yml上触发 ie kaju1

我尝试使用这段代码:

gh workflow run --repo username/repo-name --ref kaju1 pr.yml
Run Code Online (Sandbox Code Playgroud)

但这返回给我以下错误:

HTTP 404: Not Found (https://api.github.com/repos/username/repo-name/actions/workflows/pr.yml)
Run Code Online (Sandbox Code Playgroud)

github-actions github-cli

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

如何从 flutter 应用程序中的 pubspec.yaml 中提取应用程序版本,以便在 Windows 上运行的 github 操作中使用它?

我想pubspec.yaml使用 github actions 提取我的 flutter 应用程序的文件版本,然后重用此版本并将其附加到文件名。

这是我的main.yaml步骤:

build_on_push:
    if: github.event_name == 'push'
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v3
      - name: Get version from pubspec.yaml
        # this step echos "D:\a\my_app\my_app>set APP_VERSION=1.0.0+1" 
        run: |
          type pubspec.yaml | findstr /r "version:[^^]*" | for /f "tokens=2 delims=: " %%a in ('findstr /r /c:"version:[^^]*" pubspec.yaml') do set APP_VERSION=%%a
          echo APP_VERSION=!APP_VERSION!>>$GITHUB_ENV
        shell: cmd
      # doesnt work
      - name: Display the version retrieved from pubspec
        run: echo ${{ env.APP_VERSION }}
        shell: cmd
      # …
Run Code Online (Sandbox Code Playgroud)

windows cmd flutter github-actions

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

如何在作业之间传递作业级别环境变量 - Github Actions

我想阅读var1=goodmainjob2 的内部内容,但是,它没有打印。

name: Main Workflow

on:
  push:
    branches:
      - main

jobs:
  mainjob1:
    runs-on: ubuntu-latest

    steps:
      - name: Set Variable
        run: |
          echo "var1=good" >> $env:GITHUB_ENV

  mainjob2:
    needs: mainjob1
    runs-on: ubuntu-latest

    steps:

      - name: Access Variable
        run: |
          echo "var1=${{ env.var1 }}"
Run Code Online (Sandbox Code Playgroud)

我需要访问变量步骤的帮助。

我尝试了以下方法,但没有一个起作用。

          echo "var1=${{ needs.mainjob1.env.var1 }}"
          echo "var1=${{ needs.mainjob1.output.env.var1 }}"
Run Code Online (Sandbox Code Playgroud)

github environment-variables github-actions

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

由于环保规则,分支“master”不允许部署到github-pages

我将要从主分支部署的操作工作流程复制到gh-pages官方 github 启动工作流程:

https://github.com/actions/starter-workflows/blob/main/pages/static.yml

这是我使用的版本:

# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: [$default-branch]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress …
Run Code Online (Sandbox Code Playgroud)

github-actions

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

github 操作分钟数是如何计算的?

仅运行一次工作流程后,我可以看到已用完 387 分钟。(当然我之前查过:0分钟/新鲜计费周期):

在此输入图像描述

奇怪的是:在工作流程详细信息中,只列出了 56 分钟的计费时间。我很困惑。任何想法?

在此输入图像描述

github github-actions

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

Azure Github 应用程序部署错误:发布配置文件不包含 kudu URL

我遇到了这个错误,我看到很多人在 GitHub 上使用 Azure 的自动部署管道功能时也遇到了同样的错误。我已经通过直接在 Azure 门户上的部署管道将我的 GitHub 存储库链接到我的应用服务。一切似乎都运行良好,但在 GitHub Actions 页面上,我看到了以下错误:

Failed to fetch credentials from Publish Profile. For more details on how to set publish profile credentials refer https://aka.ms/create-secrets-for-GitHub-workflows
Run Code Online (Sandbox Code Playgroud)

Deployment Failed with Error: Error: Publish profile does not contain kudu URL
Run Code Online (Sandbox Code Playgroud)

因此,在这里我将正式发布此错误的解决方案,供其他遇到此问题的人使用。

azure azure-web-app-service github-actions

0
推荐指数
1
解决办法
817
查看次数