little-core-labs / netrc-creds

Install netrc creds to your Github Action environment

Home Page:https://github.com/marketplace/actions/netrc-credentials

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why read creds as a JSON blob from YAML instead of YAML directly?

jpmckinney opened this issue · comments

It'd be nicer to be able to write:

creds:
  - machine: github.com
    login: my-user
    password: ${{ secrets.PASSWORD }}

I agree! Unfortunately GitHub actions (at least at the time of writing) didn't support structured with variables.

https://github.community/t/structured-inputs-input-objects-and-arrays/17783/3

Do you know if it supports that now?

But now that you bring it up, an alternative API would be that you call netrc-creds multiple times with single entries to add.

wyt?

Alternative that COULD work (maybe)

name: Example installing netrc creds

on: [push]

env:
  - login: l12s-bot

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - uses: actions/checkout@v1
    - uses: little-core-labs/netrc-creds@v2
       with:
         machine: github.com
         login: ${{env.login}}
         password: ${{ secrets.GH_MACHINE_TOKEN }}
    - uses: little-core-labs/netrc-creds@v2
       with:
         machine: api.github.com
         login: ${{env.login}}
         password: ${{ secrets.GH_MACHINE_TOKEN }}

Is this better? Maybe. A structured variable for actions would be the best, but maybe this is cleaner.

These vars could probably be added in a non-breaking way, as long as the action is smart enough to concat to the end of an existing file.

PRs welcome on this one. I might get around to it next year.

Each call to the action could append the JSON data from 'creds', and also append a single entry based on the structured input variables.

Ah, I see. Also here: https://github.community/t/can-action-inputs-be-arrays/16457/3

It looks like other actions use repetitive calls: https://github.com/shimataro/ssh-key-action#install-multiple-keys

I'm okay with it as-is, but it would be a nice addition :)

Going to take a stab at this maybe next week.

Thanks, it works!