Skip to content

Feat(update): Added Job summary for lint.yml workflow #28

Feat(update): Added Job summary for lint.yml workflow

Feat(update): Added Job summary for lint.yml workflow #28

Workflow file for this run

name: "Lint"
on:
workflow_call:
permissions:
contents: read
pull-requests: read
jobs:
ts-lint:
name: Lint TypeScript
runs-on: ubuntu-22.04
steps:
- name: Adding markdown for Typescript
run: echo '### Lint TypeScript ✨' >> $GITHUB_STEP_SUMMARY
- name: Checkout
uses: actions/[email protected]
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.14.2
cache: yarn
cache-dependency-path: ./internal/lookout/ui/yarn.lock
- name: Check TypeScript formatting
id: ts-lint
run: |
yarn install --frozen-lockfile && yarn run fmt > lint_results.txt || exit 0
echo "::set-output name=lint_results::$(cat lint_results.txt)"
exit $(git status -s -uno | wc -l)
working-directory: ./internal/lookout/ui
- name: Generate list using Markdown
id: ts-lint-summary
run: |
if [ ${{ steps.ts-lint.outcome }} == 'success' ]; then
echo "- ✔️ Checked out the repository" >> $GITHUB_STEP_SUMMARY
echo "- ✔️ Set up Node.js with version 16.14.2 and cached Yarn dependencies" >> $GITHUB_STEP_SUMMARY
echo "- ✔️ Checked TypeScript formatting" >> $GITHUB_STEP_SUMMARY
else
echo "- ❌ Checked out the repository" >> $GITHUB_STEP_SUMMARY
echo "- ❌ Set up Node.js with version 16.14.2 and cached Yarn dependencies" >> $GITHUB_STEP_SUMMARY
echo "- ❌ TypeScript formatting check failed" >> $GITHUB_STEP_SUMMARY
echo "::error::Linting issues found. Check the details below." >> $GITHUB_STEP_SUMMARY
cat lint_results.txt >> $GITHUB_STEP_SUMMARY
fi
continue-on-error: true
go-lint:
name: Lint Go

Check failure on line 48 in .github/workflows/lint.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/lint.yml

Invalid workflow file

You have an error in your yaml syntax on line 48
runs-on: ubuntu-22.04
env:
LINT_RESULTS: ""
steps:
- name: Adding markdown
run: echo '### Lint Go ✨' >> $GITHUB_STEP_SUMMARY
- name: Checkout
uses: actions/[email protected]
- name: Setup Golang with Cache
uses: magnetikonline/action-golang-cache@v4
with:
go-version: "1.20"
- name: Lint using golangci-lint
id: go-lint
uses: golangci/golangci-lint-action@v3
with:
skip-pkg-cache: true
skip-build-cache: true
version: v1.52.2
only-new-issues: true
args: --timeout=10m --issues-exit-code=1 --sort-results ./...
- name: Save Go linting results
if: ${{ always() }}
run: |
echo "${{ steps.go-lint.outputs.stdout }}" | grep "::error" | awk -F "::error file=" '{print $2}' | sed 's/ column=/:/; s/::error /: /' > lint_results.txt
export LINT_RESULTS=$(cat lint_results.txt)
continue-on-error: true
- name: Generate list using Markdown
id: go-lint-summary
run: |
echo "- ✔️ Checked out the repository" >> $GITHUB_STEP_SUMMARY
echo "- ✔️ Set up Go with version 1.20 and cached dependencies" >> $GITHUB_STEP_SUMMARY
if [ -n "$LINT_RESULTS" ]; then
echo "- ❌ Go lint check failed" >> $GITHUB_STEP_SUMMARY
echo "::error::Linting issues found. Check the details below." >> $GITHUB_STEP_SUMMARY
echo "$LINT_RESULTS" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "- ✔️ Go lint check passed" >> $GITHUB_STEP_SUMMARY
echo "::warning::No linting issues found." >> $GITHUB_STEP_SUMMARY
fi
continue-on-error: true
if: ${{ always() }}