Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudTT committed Sep 18, 2024
1 parent f701ba8 commit f9b5a22
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/lint-and-license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
node-version: '16'

- name: Install dependencies
working-directory: app/frontend
working-directory: app/frontend # Adjust path according to your repo structure
run: npm install

- name: Run ESLint and Capture Output
Expand All @@ -45,14 +45,26 @@ jobs:
echo "$clean_output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Extract only the errors (ignore warnings)
lint_errors=$(echo "$clean_output" | grep 'error')
# Check if there are any lint errors
if [ -n "$lint_errors" ]; then
# Process output to group errors under file paths
grouped_errors=""
current_file=""
while IFS= read -r line; do
if echo "$line" | grep -q '^\s*\/'; then
# Detected a file path line, update the current file
current_file="$line"
grouped_errors+="$line\n"
elif echo "$line" | grep -q 'error'; then
# Detected an error line, associate with the current file
grouped_errors+=" $line\n"
fi
done <<< "$clean_output"
# Store grouped errors in environment variable
if [ -n "$grouped_errors" ]; then
echo "Errors found."
echo "LINT_ERRORS<<EOF" >> $GITHUB_ENV
echo "$lint_errors" >> $GITHUB_ENV
echo "GROUPED_ERRORS<<EOF" >> $GITHUB_ENV
echo -e "$grouped_errors" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "HAS_ERRORS=true" >> $GITHUB_ENV
else
Expand All @@ -67,7 +79,7 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const lintErrors = process.env.LINT_ERRORS;
const lintErrors = process.env.GROUPED_ERRORS;
const issueNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
Expand Down

0 comments on commit f9b5a22

Please sign in to comment.