因此,我有一个 GitHub 工作流程,它在推送时运行并检查特定目录中的更改,并在有更改时运行脚本。然而,对于当前的实现 ( git diff HEAD^ HEAD),它仅检查最后 2 次提交之间的差异。完全有可能推送超过 1 个提交,因此我正在寻找一种方法来比较最后 2 个推送的提交。
如果有人能帮助我,那就太好了!
使用公共 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) 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 …
我正在构建一个正在部署 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\nRun Code Online (Sandbox Code Playgroud)\n我的问题是如何配置工作流程,以便在运行时它会回答“是”?
\n谢谢!
\n我的仓库中有两个分支,即main和kaju1,
在main分支(默认)上,定义了两个工作流push.yml和test.yml。
在kaju1分支上,定义了push.yml、test.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) 我想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) 我想阅读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) 我将要从主分支部署的操作工作流程复制到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 上使用 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)
因此,在这里我将正式发布此错误的解决方案,供其他遇到此问题的人使用。
github-actions ×10
github ×4
.net ×1
azure ×1
cmd ×1
flutter ×1
git ×1
git-diff ×1
github-cli ×1
keystonejs ×1
node.js ×1
npm ×1
nuget ×1
windows ×1