Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ patchesJSON6902:
| Name | Description | Default |
|------|-------------|--------|
| `working-dir` | Working directory to run the digestabot, to run in a specific path, if not set will run from the root | `.` |
| `include-files` | Files (names or globs, comma-separated) that will be scanned for digest updates. | `*.yaml,*.yml,Dockerfile*,Makefile*,*.sh,*.tf,*....` |
| `token` | GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT) | `${{ github.token }}` |
| `signoff` | Add `Signed-off-by` line by the committer at the end of the commit log message. | `false` |
| `author` | The author name and email address in the format `Display Name <email@address.com>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor_id }}+${{...` |
Expand Down
19 changes: 18 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: Working directory to run the digestabot, to run in a specific path, if not set will run from the root
required: false
default: .
include-files:
description: Files (names or globs, comma-separated) that will be scanned for digest updates.
required: false
default: '*.yaml,*.yml,Dockerfile*,Makefile*,*.sh,*.tf,*.tfvars'
token:
description: 'GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT)'
required: true
Expand Down Expand Up @@ -87,6 +91,9 @@ runs:
run: |
# disable the errexit github enable that by default
set +o errexit

IFS=',' read -ra PATTERNS <<< "${{ inputs.include-files }}"

json='{}'
while IFS= read -r -d '' file; do
if [[ "$file" == *testdata* ]]; then
Expand Down Expand Up @@ -136,7 +143,17 @@ runs:
'.updates += [{file: $file, image: $image, digest: $digest, updated_digest: $updated_digest}]' <<<"${json}")
fi
done
done < <(find "${{ inputs.working-dir }}" -type f \( -name "*.yaml" -o -name "*.yml" -o -name "Dockerfile*" -o -name "Makefile*" -o -name "*.sh" -o -name "*.tf" -o -name "*.tfvars" \) -print0)
done < <(
find_args=()
for i in "${!PATTERNS[@]}"; do
if [ $i -eq 0 ]; then
find_args+=(-name "${PATTERNS[$i]}")
else
find_args+=(-o -name "${PATTERNS[$i]}")
fi
done
find "${{ inputs.working-dir }}" -type f \( "${find_args[@]}" \) -print0
)

echo "json=${json}" >> "${GITHUB_OUTPUT}"

Expand Down