-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.54 KB
/
get-changed-images.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Get Changed Images"
on:
workflow_call:
outputs:
addedOrModified:
description: "Whether any files were added or modified"
value: ${{ jobs.get-changed-images.outputs.addedOrModified }}
addedOrModifiedImages:
description: "The images that were added or modified"
value: ${{ jobs.get-changed-images.outputs.addedOrModifiedImages }}
jobs:
get-changed-images:
name: Get Changed Images
runs-on: ubuntu-latest
outputs:
addedOrModified: "${{ steps.changed-files.outputs.all_changed_and_modified_files_count > 0 }}"
addedOrModifiedImages: "${{ steps.changed-containers.outputs.addedOrModifiedImages }}"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: apps/**
dir_names: true
dir_names_max_depth: 2
json: true
escape_json: false
- if: ${{ steps.changed-files.outputs.all_changed_and_modified_files_count > 0 }}
name: Determine changed images
id: changed-containers
shell: bash
run: |
IMAGES=$( \
echo '${{ steps.changed-files.outputs.all_changed_and_modified_files }}' \
| jq --raw-output 'map(sub("^apps/"; "")) | join(",")' \
)
echo "addedOrModifiedImages=${IMAGES}" >> $GITHUB_OUTPUT