Skip to content

Using the output of tj-actions / changed-files in a loop for containers #1149

Answered by jackton1
ServerGeek82 asked this question in Q&A
Discussion options

You must be logged in to vote

@ServerGeek82 The output of all_changed_files likely includes multiple files separated by spaces.

It can be passed to docker-compose with multiple -f options. e.g -f [FILE1] -f [FILE2]

Example:

      - name: Get docker-compose options
        run: |
          ALL_CHANGED_FILES=(${{ steps.changed-files-specific.outputs.all_changed_files }})
          ARGS=""
          for file in "${ALL_CHANGED_FILES[@]}"; do
            ARGS+="-f $file"
          done
         # Pass the args to docker-compose

Warning:

The id value should match what's used in the changed-files action in this case it should be changed-files-specific.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jackton1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants