Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CI): Add GitHub Markdown summary for linter CI #412

Merged
merged 45 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b4f594a
test: Added a comment to check for failed lint check
SaptarshiSarkar12 Jan 11, 2024
384eaf0
fix: Set continue on error option to true to upload artifacts
SaptarshiSarkar12 Jan 11, 2024
22957d8
test: Added a wrong package name to check for failed linter workflow
SaptarshiSarkar12 Jan 11, 2024
6888a93
test: Added a wrong package name to check for failed linter workflow
SaptarshiSarkar12 Jan 11, 2024
d7f344c
feat(CI): Added Workflow summary generation support to linter CI
SaptarshiSarkar12 Jan 11, 2024
5725410
revert: Reverted back the changes made solely for testing CI
SaptarshiSarkar12 Jan 11, 2024
4e2f6ad
fix: added ansi-remover
SaptarshiSarkar12 Jan 11, 2024
1102c19
fix: added ansi-remover
SaptarshiSarkar12 Jan 11, 2024
95a6e51
feat(CI): Added Workflow summary generation support to linter CI
SaptarshiSarkar12 Jan 11, 2024
fc11ee2
feat(CI): Added Workflow summary generation support to linter CI
SaptarshiSarkar12 Jan 11, 2024
b58d071
feat(CI): Added Workflow summary generation support to linter CI
SaptarshiSarkar12 Jan 11, 2024
ddb2a5a
fix(CI): Fixed extra newlines in workflow summary
SaptarshiSarkar12 Jan 11, 2024
101792a
fix(CI): Fixed extra newlines in workflow summary
SaptarshiSarkar12 Jan 11, 2024
e47caf0
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
37d8d98
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
12fc225
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
a72d849
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
58bab17
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
81b2f2a
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
4777bc7
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 11, 2024
b037c63
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 12, 2024
f5b6042
feat(CI): Added PR comment code
SaptarshiSarkar12 Jan 12, 2024
3b2563d
feat(CI): Added PR comment permission
SaptarshiSarkar12 Jan 12, 2024
87e2025
feat(CI): Added PR comment permission
SaptarshiSarkar12 Jan 12, 2024
98ccef5
feat(CI): Added PR comment permission
SaptarshiSarkar12 Jan 12, 2024
d04ed94
feat(CI): Added PR comment permission
SaptarshiSarkar12 Jan 12, 2024
926bf7c
feat(CI): Added PR comment permission
SaptarshiSarkar12 Jan 12, 2024
c5b21ee
feat(CI): Added PR comment permission
SaptarshiSarkar12 Jan 12, 2024
2c00aa1
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
0865da8
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
63b033b
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
0a567c5
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
d3c571d
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
4246087
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
e33da4a
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
a310eb1
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
58b0df7
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
9afcb64
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
fac092a
fix(CI): Fixed gh pr comment formatting issue
SaptarshiSarkar12 Jan 12, 2024
728a072
feat(CI): Added limit to run only the latest trigger
SaptarshiSarkar12 Jan 12, 2024
ece184c
feat(CI): Added limit to run only the latest trigger
SaptarshiSarkar12 Jan 12, 2024
470ff8d
feat(CI): Added limit to run only the latest trigger
SaptarshiSarkar12 Jan 12, 2024
654e888
revert: Reverted back the changes made solely for testing CI
SaptarshiSarkar12 Jan 12, 2024
5f35435
chore: Changed the summary for successful run of linter
SaptarshiSarkar12 Jan 12, 2024
b85a57d
fix: Fixed failure in running Build CI in source branch if it is trig…
SaptarshiSarkar12 Jan 12, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
type: boolean

concurrency:
group: ${{ github.ref }}
group: ${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Expand Down
48 changes: 45 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ on:
push:
pull_request:

concurrency:
group: ${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
contents: write
pull-requests: write
issues: write
statuses: write
packages: read
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -20,7 +26,9 @@ jobs:
# list of changed files within `super-linter`
fetch-depth: 0
- name: Lint Code Base
id: lint
uses: super-linter/super-linter/slim@v5
continue-on-error: true
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -39,4 +47,38 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: linter-result
path: super-linter.log
path: super-linter.log
- name: Generate Workflow Summary for successful run
if: ${{ steps.lint.outcome == 'success' }}
run: |
echo "## :ballot_box_with_check: Linting passed!" >> $GITHUB_STEP_SUMMARY
- name: Generate Workflow Summary for failed run
if: ${{ steps.lint.outcome == 'failure' }}
run: |
echo "## :x: Linting errors found!" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat super-linter.log | grep "\[ERROR]" | sed 's/[0-9A-Z:.-]\+ [0-9:]\+ //' | sed 's/\[ERROR]//' | sed 's/ //' | sed 's/Found errors in \[[A-Za-z]\+\] linter!//' | sed 's/Error code: 1. Command output://' | sed 's/ //' | sed 's/ERRORSFOUND//' | sed 's/ in [A-Z:]\+//' | sed 's/[[0-9]\+]//' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g" | sed '1,2d' | tr -s '\n' '\n' | sed 's/\/github\/workspace\///' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
SaptarshiSarkar12 marked this conversation as resolved.
Show resolved Hide resolved
- name: Comment on PR for failed run
if: ${{ steps.lint.outcome == 'failure' && github.event_name == 'pull_request' }}
shell: bash
run: |
COMMENT_INITIAL=$(echo -e "## :x: Linting errors found!\n")
COMMENT_MIDDLE=$(cat super-linter.log | grep "\[ERROR]" | sed 's/[0-9A-Z:.-]\+ [0-9:]\+ //' | sed 's/\[ERROR]//' | sed 's/ //' | sed 's/Found errors in \[[A-Za-z]\+\] linter!//' | sed 's/Error code: 1. Command output://' | sed 's/ //' | sed 's/ERRORSFOUND//' | sed 's/ in [A-Z:]\+//' | sed 's/[[0-9]\+]//' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g" | sed '1,2d' | tr -s '\n' '\n' | sed 's/\/github\/workspace\///')
COMMENT_BODY=$(echo -e "$COMMENT_INITIAL \n @${{ github.actor }} Please fix the following errors:\n\n\`\`\`\n$COMMENT_MIDDLE\n\`\`\`")
COMMENT=$(echo "$COMMENT_BODY")
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-f body="$COMMENT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail Workflow for failure in linting
if: ${{ steps.lint.outcome == 'failure' }}
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
core.setFailed("Linting errors found! Please check workflow summary for details.")
SaptarshiSarkar12 marked this conversation as resolved.
Show resolved Hide resolved