GitHub Actions workflow error: Permission denied

Evandro Pomatti picture Evandro Pomatti · Sep 7, 2019 · Viewed 11.8k times · Source

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

Answer

Evandro Pomatti picture Evandro Pomatti · Oct 20, 2019

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.