Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions .github/workflows/scandir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ jobs:

- name: Verify check
run: |
expect="testfiles/scandir/run[[:space:]]me.bash"
expect1="testfiles/scandir/run[[:space:]]me.bash"
expect2="testfiles/scandir/exec"
notexpect="testfiles/test.bash"

if [[ ! "${{ steps.one.outputs.files }}" =~ $expect ]];then
echo "::error:: Expected file $expect not found in ${{ steps.one.outputs.files }}"
if [[ ! "${{ steps.one.outputs.files }}" =~ $expect1 ]];then
echo "::error:: Expected file $expect1 not found in ${{ steps.one.outputs.files }}"
exit 1
if [[ ! "${{ steps.one.outputs.files }}" =~ $expect2 ]];then
echo "::error:: Expected file $expect2 not found in ${{ steps.one.outputs.files }}"
Comment thread
mislav marked this conversation as resolved.
exit 1
elif [[ "${{ steps.one.outputs.files }}" =~ $notexpect ]];then
echo "::error:: Expected file $notexpect found in ${{ steps.one.outputs.files }}"
Expand Down
6 changes: 5 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ runs:
')' \
-print0)

perm_executable="/111"
# BSD find on macOS does not support the slash syntax for permissions.
[ "$(uname -s)" = "Darwin" ] && perm_executable="+111"
Comment thread
mislav marked this conversation as resolved.

while IFS= read -r -d '' file; do
head -n1 "$file" | grep -Eqs "$shebangregex" || continue
filepaths+=("$file")
done < <(find "${INPUT_SCANDIR}" \
${INPUT_EXCLUDE_ARGS} \
-type f ! -name '*.*' -perm /111 \
-type f ! -name '*.*' -perm "$perm_executable" \
-print0)

if [[ -n "${INPUT_CHECK_TOGETHER}" ]]; then
Expand Down
3 changes: 3 additions & 0 deletions testfiles/scandir/exec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

echo "I am executable"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

💡 Codebase verification

Based on the script results, I can generate the final response as we have all the necessary information:

Add newline at end of file (permissions are correct)

The file already has the correct executable permissions (-rwxr-xr-x), but it's missing a newline at the end as verified by the script output. Please add a newline at the end of the file to follow POSIX standards.

Note: I chose the tag because while the executable permissions are correct (one part of the verification), the script confirmed the missing newline issue (the other part of the verification), which needs to be addressed.

🔗 Analysis chain

Add newline at end of file and verify executable permissions.

  1. Add a newline at the end of the file to follow POSIX standards.
  2. Ensure the file has executable permissions for testing.

Let's verify the file permissions and content:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify file permissions and content
# Expected: File should be executable and end with a newline

# Check if the file is executable
ls -l testfiles/scandir/exec

# Check if file ends with a newline
if [ -n "$(tail -c1 testfiles/scandir/exec)" ]; then
  echo "Warning: No newline at end of file"
fi

Length of output: 231