GitHub Actions workflow error: Permission denied

心已入冬 提交于 2020-01-05 04:11:27

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/57830375/github-actions-workflow-error-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!