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

list-targets: Allow passing multi-line files #247

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

shink
Copy link
Contributor

@shink shink commented Sep 13, 2024

Previously only comma-separated values ​​were supported:

- uses: docker/bake-action/subaction/list-targets@v5
  with:
    files: arg.json,docker-bake.hcl

Now we can pass multi-line values, which is much better:

- uses: docker/bake-action/subaction/list-targets@v5
 with:
   files: |
     arg.json
     docker-bake.hcl

I just made a quick change, can anyone review it? Thanks!

@crazy-max crazy-max changed the title [List-Target Action] Allow passing multi-line files list-targets: Allow passing multi-line files Sep 30, 2024
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 32 to 37
const files = `${{ inputs.files }}`
? `${{ inputs.files }}`
.replace(/\n/g, ',')
.split(',')
.filter(Boolean)
: [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use a regexp for this:

const files = `${{ inputs.files }}` ? `${{ inputs.files }}`.split(/[\r?\n,]+/) : [];

@shink
Copy link
Contributor Author

shink commented Sep 30, 2024

@crazy-max thanks so much for your review! I'll do this after my holiday.

@shink shink force-pushed the list-targets/files branch from 5dd4173 to 338eede Compare October 8, 2024 08:43
@shink
Copy link
Contributor Author

shink commented Oct 8, 2024

@crazy-max It's ready for review, please take a look and trigger the CI, thanks!

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you squash your commits please?

@crazy-max
Copy link
Member

@shink
Copy link
Contributor Author

shink commented Oct 8, 2024

ah yes, but the other two jobs are the same. I'm doing some changes to them.

@crazy-max
Copy link
Member

crazy-max commented Oct 8, 2024

ah yes, but the other two jobs are the same. I'm doing some changes to them.

I think you could just create a group-multi-files folder with docker-bake.hcl and docker-bake-2.hcl files like:

# docker-bake.hcl
group "default" {
  targets = ["t1", "t2", "t3"]
}

target "t1" {
  target = "t1"
}

target "t2" {
  target = "t2"
}
# docker-bake-2.hcl
target "t3" {
  target = "t3"
}

Signed-off-by: Yuanhao Ji <jiyuanhao@apache.org>
@shink shink force-pushed the list-targets/files branch from 5d740e8 to d5f3322 Compare October 8, 2024 09:05
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@crazy-max crazy-max merged commit 51e939b into docker:master Oct 8, 2024
41 checks passed
@shink
Copy link
Contributor Author

shink commented Oct 8, 2024

Thanks for the quick and patient review!

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

Successfully merging this pull request may close these issues.

2 participants