[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jpmckinney opened this issue Dec 23, 2020 · 7 comments
Closed

Comments

@jpmckinney
Copy link
Contributor
jpmckinney commented Dec 23, 2020

It'd be nicer to be able to write:

creds:
  - machine: github.com
    login: my-user
    password: ${{ secrets.PASSWORD }}
@bcomnes
Copy link
Contributor
bcomnes commented Dec 23, 2020

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?

@bcomnes
Copy link
Contributor
bcomnes commented Dec 23, 2020

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 }}

@bcomnes
Copy link
Contributor
bcomnes commented Dec 23, 2020

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.

@jpmckinney
Copy link
Contributor Author

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 :)

@bcomnes
Copy link
Contributor
bcomnes commented Dec 27, 2020

Going to take a stab at this maybe next week.

@bcomnes
Copy link
Contributor
bcomnes commented Dec 28, 2020

Added a direct input method:

https://github.com/little-core-labs/netrc-creds/releases/tag/v2.1.0

lmkwyt

@bcomnes bcomnes closed this as completed Dec 28, 2020
@jpmckinney
Copy link
Contributor Author

Thanks, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants