GitHub Actions工作流错误:权限被拒绝 [英] GitHub Actions workflow error: Permission denied

查看:298
本文介绍了GitHub Actions工作流错误:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行GitHub Actions工作流,但由于以下错误而失败。

 未处理的异常:
FileSystemException:无法创建文件,路径='/github/home/.flutter'(操作系统错误:权限被拒绝,errno = 13)

我查看了工作流语法GitHub Actions ,但找不到任何解决方案。



我的构建文件如下:

 名称:Flutter CI 

上:[推]

工作:
生成:

运行:Ubuntu最新的

容器:
图片:cirrusci / flutter:v1.7.8-hotfix.4

步骤:
-使用:action / checkout @ v1
-名称:安装依赖项
运行:flutter pub get
工作目录:my_app
-名称:运行测试
运行:颤振测试


解决方案

最后有时间看看它,并添加 sudo 即可解决。 / p>

图片与用户 cirrus 一起运行。还需要提供完整路径:

  sudo / home / cirrus / sdks / flutter / bin / flutter pub get 

来自GitHub 文档


The Linux和macOS虚拟机均使用无密码sudo运行。
当您需要执行命令或安装需要比当前用户更多的
特权的工具时,可以使用sudo而不需要
提供密码。



I'm running a GitHub Actions workflow and it is failing with the following error.

Unhandled exception:
FileSystemException: Cannot create file, path = '/github/home/.flutter' (OS Error: Permission denied, errno = 13)

I looked in Workflow syntax for GitHub Actions but couldn't find any instruction to solve this.

My build file is looking like this:

name: Flutter CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    container:
      image:  cirrusci/flutter:v1.7.8-hotfix.4

    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: flutter pub get
      working-directory: my_app
    - name: Run tests
      run: flutter test

解决方案

Finally got the time to look at it and adding sudo solved it.

The image runs with user cirrus. It is also required to provide the full path:

sudo /home/cirrus/sdks/flutter/bin/flutter pub get

From GitHub docs:

The Linux and macOS virtual machines both run using passwordless sudo. When you need to execute commands or install tools that require more privileges than the current user, you can use sudo without needing to provide a password.

这篇关于GitHub Actions工作流错误:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆