diff --git a/action.yml b/action.yml index 8754a97..4473fb6 100644 --- a/action.yml +++ b/action.yml @@ -38,10 +38,10 @@ inputs: required: false default: 'true' - target: - description: "Configuration name" + command: + description: "Atmos command to generate readme" required: true - default: 'readme' + default: 'docs generate readme' validate_readme: required: false @@ -232,15 +232,20 @@ runs: env: GITHUB_TOKEN: "${{ inputs.token }}" run: | - output_file=$(atmos docs generate ${{ inputs.target }} 2>&1 | sed -n -e "s/^.*output=//p") - # Get relative path from absolute - output_file=$(realpath -s --relative-to="$PWD" "$output_file") - # Ignore changes if they are only whitespace - if ! git diff --quiet ${output_file} && git diff --ignore-all-space --ignore-blank-lines --quiet ${output_file}; then - git restore ${output_file} - echo Ignoring whitespace-only changes in generated file - fi - echo "file=${output_file}" >> $GITHUB_OUTPUT + set +e + atmos ${{ inputs.command }} + # Get all changed files and process them + changed_files=$(git status --porcelain | grep -E "^\s?(M|\?\?)" | cut -c4-) + set -e + for file in $changed_files; do + # Ignore changes if they are only whitespace + if ! git diff --quiet "$file" && git diff --ignore-all-space --ignore-blank-lines --quiet "$file"; then + git restore "$file" + echo "Ignoring whitespace-only changes in generated file: $file" + fi + done + files="$(echo ${changed_files})" + echo "file=${files// /,}" >> $GITHUB_OUTPUT - uses: gaurav-nelson/github-action-markdown-link-check@v1 if: inputs.readme_enabled == 'true' && inputs.validate_readme == 'true' @@ -300,10 +305,7 @@ runs: committer: ${{ inputs.commit_author }} sign-commits: ${{ inputs.sign-commits }} add-paths: | - ${{ steps.banner.outputs.file }} - ${{ steps.readme.outputs.file }} - **/README.md - docs/* + ${{ steps.banner.outputs.file }},${{ steps.readme.outputs.file }} body: |- ## what This is an auto-generated PR that updates the README.md and docs