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

Allow specifying commit and branch in the same field #242

Open
mstorsjo opened this issue May 31, 2023 · 4 comments
Open

Allow specifying commit and branch in the same field #242

mstorsjo opened this issue May 31, 2023 · 4 comments

Comments

@mstorsjo
Copy link

When integrating with other github actions, many allow specifying either a branch name or a commit id in the same field, such as the ref field in https://github.com/actions/checkout. It would be convenient if action-download-artifact also would allow intermixing commits and branch names in this way - either by adding a new field ref which takes either, or allowing passing a branch name in the commit field.

@mstorsjo
Copy link
Author

mstorsjo commented Jun 1, 2023

As a concrete example, my workflow might look like this:

on:
  workflow_dispatch:
    inputs:
      commit:
        description: 'Commit to extract from'
        type: string
      branch:
        description: 'Branch to extract from'
        type: string

jobs:
  do-things:
    runs-on: ubuntu-latest
    steps:
      - name: Download artifacts
        uses: dawidd6/action-download-artifact@v2
        with:
          commit: ${{inputs.commit}}
          branch: ${{inputs.branch}}
          event: push
      - uses: actions/checkout@v3
        with:
          ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
          path: repo

If there would be only one single field to pass to action-download-artifact, it would make the use with other actions such as actions/checkout more convenient.

@dawidd6
Copy link
Owner

dawidd6 commented Aug 11, 2023

Care to open a PR for that? It looks useful indeed.

@mstorsjo
Copy link
Author

Care to open a PR for that? It looks useful indeed.

I'm not very familiar with modern (last 20 years) JavaScript, so while I guess I could make an attempt, I think the end result is better if someone else tries :-)

@dawidd6
Copy link
Owner

dawidd6 commented Mar 16, 2024

I don't think we use anything modern in this action's codebase 😄 . Well, other than some 3rd party libraries...

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