标签: github-actions

GitHub Action 中 id-token 的权限范围是多少?

下面的例子是什么意思id-token,有什么用?

jobs:
  job_id:
    # Add "id-token" with the intended permissions.
    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
    - id: 'auth'
      uses: 'google-github-actions/auth@v0'
      with:
        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'

    - name: 'Set up Cloud SDK'
      uses: 'google-github-actions/setup-gcloud@v0'

    - name: 'Use gcloud CLI'
      run: 'gcloud info'
Run Code Online (Sandbox Code Playgroud)

该示例来自setup-gcloud

我尝试查看doc1doc2。但是,我找不到任何有用的信息。

你能给我一些提示/建议吗?

github github-actions

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

使用 docker 的 github 操作会出现错误“导出到图像 403 禁止错误”

name: CI/CD Docker\n\non:\n  push:\n    branches: [main]\n\nenv:\n  DOCKER_IMAGE: ghcr.io/${{ github.actor }}/github-actions-auto\n  VERSION: ${{ github.sha }}\n  NAME: go_cicd\n\njobs:\n  build:\n    name: Build\n    runs-on: ubuntu-latest\n    steps:\n      # github repository\xec\x97\x90\xec\x84\x9c checkout\n      - uses: actions/checkout@v2\n      - name: Set up docker buildx\n        id: buildx\n        uses: docker/setup-buildx-action@v1\n      - name: Cache docker layers\n        uses: actions/cache@v2\n        with:\n          path: /tmp/.buildx-cache\n          key: ${{ runner.os }}-buildx-${{ env.VERSION }}\n          restore-keys: |\n            ${{ runner.os }}-buildx-\n      - name: Login to ghcr\n        uses: docker/login-action@v1\n        with:\n          registry: ghcr.io\n          username: ${{ github.actor }}\n          password: ${{ secrets.GHCR_TOKEN }}\n      - name: …
Run Code Online (Sandbox Code Playgroud)

docker github-actions

6
推荐指数
2
解决办法
6523
查看次数

使用github操作部署firebase云函数

我正在尝试使用 github 操作部署我的 firebase 云功能应用程序:

name: Deploy

'on':
  push:
    branches:
      - main

jobs:
  deploy_to_production:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: install dependencies
        run: cd functions/ && npm install
      - name: deploy to production
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only functions
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          
Run Code Online (Sandbox Code Playgroud)

“部署到生产”步骤未成功。我激活调试模式,但实际上没有收到任何有用的信息:

##[debug]Evaluating: secrets.FIREBASE_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'FIREBASE_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'deploy to production'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: …
Run Code Online (Sandbox Code Playgroud)

github firebase google-cloud-functions github-actions

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

错误解析在 github 中称为工作流程。未找到工作流程

尝试将 pulumi 预览与 Github 操作一起使用。工作流程文件给我以下错误。

无效的工作流程文件:.github/workflows/pull_request.yml#L12

错误解析调用工作流程“peopleticker/ccc/.github/workflows/pull_request.yml@master”:找不到工作流程。

我正在使用下面的工作流程文件,请检查:

name: Call a reusable workflow

permissions:
  id-token: write
  contents: read

on:
  pull_request:

jobs:
  call-workflow-passing-data:
    uses: peopleticker/ccc/.github/workflows/pull_request.yml@master
Run Code Online (Sandbox Code Playgroud)

github pulumi github-actions

6
推荐指数
2
解决办法
7948
查看次数

在 GitHub Actions 中使用文本转换 (.tt) 模板

我正在尝试将文本转换模板(Visual Studio 的一项功能)与 GitHub Actions 结合使用。我专门使用 Windows 运行程序,它安装了 Visual Studio 2022 Enterprise,因此依赖项应该存在。

在我的.csproj文件中,我设置了如下配置:

<PropertyGroup>
    <CustomPathToTransforms>$(MSBuildExtensionsPath)</CustomPathToTransforms>
</PropertyGroup>
    
<Import Project="$(CustomPathToTransforms)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TextTemplating\Microsoft.TextTemplating.targets" />
Run Code Online (Sandbox Code Playgroud)

然后,我还确保在构建期间发生转换:

<PropertyGroup>
    <TransformOnBuild>true</TransformOnBuild>
    <TransformOutOfDateOnly>false</TransformOutOfDateOnly>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

在本地,这与 Visual Studio 2022 社区版配合良好。我添加另一个属性 ( ) 的原因CustomPathToTransforms是,在 GitHub Actions 中,我可以将其重定向到 Visual Studio 安装文件夹,而不是 .NET 工具文件夹,否则会通过MSBuildExtensionsPath.

在 GitHub Actions 中,我运行构建如下:

dotnet build --configuration Release -p:CustomPathToTransforms="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Msbuild\"
Run Code Online (Sandbox Code Playgroud)

理论上,这应该可行,并且我可以从构建输出中看出目标已正确找到,但是该步骤失败得相当惊人:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Msbuild\Microsoft\VisualStudio\v17.0\TextTemplating\Microsoft.TextTemplating.targets(347,5): error MSB4018: The "TransformTemplates" task failed unexpectedly. [D:\a\grunt\grunt\Grunt\Grunt\Grunt.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Msbuild\Microsoft\VisualStudio\v17.0\TextTemplating\Microsoft.TextTemplating.targets(347,5): error MSB4018: System.TypeLoadException: Could …
Run Code Online (Sandbox Code Playgroud)

.net msbuild csproj visual-studio github-actions

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

buildx 失败并显示:错误:docker 驱动程序当前不支持缓存导出功能

我一直在尝试设置一个 CI 管道Github Actionsdocker-hub.

我已编写以下.yml文件部分并在作业步骤.github\workflow中收到如下所示的错误。Build and Push

我试图在互联网上找到它,但我无法找到它。

name: Build and Deploy Code
on: [push, pull_request]

jobs:
  job1:
    # This will tell the job to run on ubuntu machine
    runs-on: ubuntu-latest
    env:
      DB_USER: postgres
      DB_PASSWORD: root123
      DB_HOST: postgres
      DB_PORT: 5432
      DATABASE: postgres
      SECRET_KEY: 09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7
      ALGORITHM: HS256
      ACCESS_TOKEN_EXPIRE_DAYS: 300
      REDIS_HOST: redis
      REDIS_PORT: 6379
    services:
      postgres:
        image: postgres
        env:
          POSTGRES_PASSWORD: root123
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          - …
Run Code Online (Sandbox Code Playgroud)

python docker dockerhub github-actions

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

使用没有个人访问令牌的 github 包?

我正在从事的项目目前通过 github 包部署我们的私有节点包。我们当前的工作流程是让每个开发人员创建和维护自己的个人访问令牌,然后我们使用中央帐户的 PAT 在 AWS 中实现自动化。

我想知道是否可以在不使用 Actions 或 PAT 的情况下使用 github 包进行身份验证?

github github-actions

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

我如何获取 github actions 工作流程中的提交日期

我想知道是否有任何方法可以通过环境变量或能够在 github actions 中使用它的东西来获取提交日期。

workflow github environment-variables github-actions cicd

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

在 Github Actions 中使用 Poetry 时如何解决 JSONDecodeError?

问题

\n

poetry install自从我从 Python 3.8 迁移到 Python 3.10 以来,我在任何 GitHub 运行器上的 CI/CD 管道(Github Actions)中使用时都遇到问题。

\n
Installing dependencies from lock file\n\nPackage operations: 79 installs, 0 updates, 0 removals\n  \xe2\x80\xa2 Installing pyparsing (3.0.9)\n  \nJSONDecodeError\n  \nExpecting value: line 1 column 1 (char 0)\n  at /opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/json/decoder.py:355 in raw_decode\n      351\xe2\x94\x82         """\n      352\xe2\x94\x82         try:\n      353\xe2\x94\x82             obj, end = self.scan_once(s, idx)\n      354\xe2\x94\x82         except StopIteration as err:\n    \xe2\x86\x92 355\xe2\x94\x82             raise JSONDecodeError("Expecting value", s, err.value) from None\n      356\xe2\x94\x82         return obj, end\n      357\xe2\x94\x82 \nError: Process completed with exit …
Run Code Online (Sandbox Code Playgroud)

python github-actions python-poetry python-3.10

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

如何从Vite项目的github action.yaml中的env获取env变量

我想在github action中设置一个环境变量。我可以在 Vite 项目运行时访问该变量。经验: .yaml

# staging.yaml - my github action file
...
env: VITE_INTERNAL = true
...
Run Code Online (Sandbox Code Playgroud)
// index.vue - my Vite project
function myTest(){
    console.log(process.env.VITE_INTERNAL) // I hope to get "true" instead of "undefined"
}
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我,拜托。多谢!

environment-variables vue.js github-actions vite

6
推荐指数
2
解决办法
5171
查看次数