Sorry for the thread-necromancing but still, for reference, because we just went through the same:
Generally, you have to handover some kind of access token to platformio with the correct permissions, such that it can fetch the repository via the pre-installed git of a Github Action. By default, an action (including its by-default generated GH_TOKEN environment variable), however, is only scoped to the current repository, not your/your organization’s other repositories.
Otherwise, just doing https://${sysenv.GH_TOKEN}@github.com/<owneruser/orga>/<repo>.git
in the corresponding platformio dependency would work!
Due to this limited permission scope, the easiest way for us was to instead create a Github Action for the organization, install it to organization, add its app_id as variable and its private key as secret (see Github’s official docs), and adding it to your github action as descriped via the “generate a token” step and using the “env” parameter for a step:
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
Using this for your pio run/test...
then makes the dream work, e.g.:
from your_github_action.yml:
- name: Build PlatformIO Project
run: pio run
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
from platformio.ini:
lib_deps=
https://${sysenv.GH_TOKEN}@github.com/<owneruser/orga>/<repo>.git
Disclaimer: I only tested this on an ubuntu-style Github Action runner, not windows or mac.
What’s also nice about this: local builds on your own machine still work as long as you are correctly authenticated with git and you don’t have a GH_TOKEN environment variable. Then pio just replaces the https://${sysenv.GH_TOKEN}@github.com/...
with https://github.com/...
and it should fetch the dependency as normal.