-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: switch linter workflows to the Hyperledger CI (#997)
Signed-off-by: Yurii Shynbuiev <[email protected]>
- Loading branch information
1 parent
675ff5e
commit a002269
Showing
2 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
--- | ||
name: Linter | ||
|
||
# Default shell is `sh` | ||
# which is old, use bourne-again version instead | ||
defaults: | ||
run: | ||
shell: bash | ||
name: MegaLinter | ||
|
||
on: | ||
pull_request: | ||
|
||
env: # Comment env block if you don't want to apply fixes | ||
# Apply linter fixes configuration | ||
APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool) | ||
APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all) | ||
APPLY_FIXES_MODE: pull_request # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request) | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint changes | ||
runs-on: self-hosted | ||
container: | ||
image: ghcr.io/input-output-hk/atala-qa-automation | ||
volumes: | ||
- /nix:/nix | ||
credentials: | ||
username: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
password: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
APPLY_FIXES: none | ||
megalinter: | ||
name: Megalinter | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
steps: | ||
# Git Chekcout | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
- name: Mega-Linter | ||
|
||
- name: MegaLinter | ||
id: ml | ||
uses: megalinter/[email protected] | ||
uses: oxsecurity/[email protected] | ||
|
||
- name: Archive production artifacts | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -42,3 +46,19 @@ jobs: | |
megalinter-reports | ||
mega-linter.log | ||
overwrite: true | ||
|
||
# Create pull request if applicable (for now works only on PR from same repository, not from forks) | ||
- name: Create Pull Request with applied fixes | ||
id: cpr | ||
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "style: Apply linters automatic fixes" | ||
title: "style: Apply linters automatic fixes" | ||
labels: "hyperledger-bot" | ||
- name: Create PR output | ||
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') | ||
run: | | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | ||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters