forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add MegaLinter * Fix YAML * Fix formatting * Add Flake8 config file * Check only modified files * Allow formatting commits on push events * Integrate alisw/pull-request * Comments by Timo
- Loading branch information
Showing
7 changed files
with
195 additions
and
50 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
extend-ignore = E203 |
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
# MegaLinter GitHub Action configuration file | ||
# More info at https://megalinter.github.io | ||
name: MegaLinter | ||
|
||
'on': [pull_request_target] | ||
|
||
env: # Comment env block if you do not 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) | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: MegaLinter | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Git Checkout | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# MegaLinter | ||
- name: MegaLinter | ||
id: ml | ||
# You can override MegaLinter flavor used to have faster performances | ||
# More info at https://megalinter.github.io/flavors/ | ||
uses: megalinter/megalinter@v5 | ||
env: | ||
# All available variables are described in documentation | ||
# https://megalinter.github.io/configuration/ | ||
VALIDATE_ALL_CODEBASE: false # ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} # Validates all source when push on master, else just the git diff with master. Override with true if you always want to lint all sources | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY | ||
# DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks | ||
|
||
# Create or delete the cleanup branch | ||
- name: Update cleanup branch | ||
if: ${{ github.event.repository.owner.login == 'AliceO2Group' }} | ||
env: | ||
REMOTE_URL: "https://alibuild:${{ secrets.ALIBUILD_GITHUB_TOKEN }}@\ | ||
github.com/alibuild/${{ github.event.repository.name }}" | ||
run: | | ||
# An empty CLEANUP_COMMIT means delete the branch. | ||
CLEANUP_COMMIT="" | ||
if [ "${{ steps.ml.outputs.has_updated_sources }}" = 1 ] | ||
then | ||
CLEANUP_COMMIT="HEAD" | ||
git commit -am "MegaLinter fixes" | ||
fi | ||
git push -f "$REMOTE_URL" "$CLEANUP_COMMIT:refs/heads/alibot-cleanup-ml-$PR_NUMBER" | ||
- name: Create pull request with applied fixes | ||
uses: alisw/pull-request@v2 | ||
if: steps.ml.outputs.has_updated_sources == 1 && ${{ github.event.repository.owner.login == 'AliceO2Group' }} | ||
with: | ||
source_branch: 'alibuild:alibot-cleanup-ml-${{ env.PR_NUMBER }}' | ||
destination_branch: '${{ github.event.pull_request.head.label }}' | ||
github_token: ${{ secrets.ALIBUILD_GITHUB_TOKEN }} | ||
pr_title: >- | ||
[MegaLinter] Apply linters automatic fixes to | ||
#${{ env.PR_NUMBER }} | ||
pr_body: >- | ||
Your PR ${{ github.event.repository.full_name }}#${{ env.PR_NUMBER }} | ||
cannot be merged as is. You should either run MegaLinter | ||
yourself and update the pull request, or merge this PR in yours. | ||
You can find how to run MegaLinter locally at | ||
<https://megalinter.github.io/latest/mega-linter-runner/>. | ||
continue-on-error: true # We do not create PRs if the branch is not there. | ||
|
||
- name: Exit with error if the PR is not clean | ||
run: | | ||
case "${{ steps.ml.outputs.has_updated_sources }}" in | ||
0) echo 'PR clean' ; exit 0 ;; | ||
1) echo 'PR not clean' ; exit 1 ;; | ||
esac |
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,16 +1,17 @@ | ||
--- | ||
name: "Close stale PRs" | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-pr-message: 'This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.' | ||
stale-pr-label: stale | ||
days-before-stale: 30 | ||
days-before-close: 5 | ||
- uses: actions/stale@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-pr-message: 'This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.' | ||
stale-pr-label: stale | ||
days-before-stale: 30 | ||
days-before-close: 5 |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
# Configuration file for Mega-Linter | ||
# See all available variables at https://megalinter.github.io/configuration/ and in linters documentation | ||
|
||
APPLY_FIXES: all # all, none, or list of linter keys | ||
DEFAULT_BRANCH: master # Usually master or main | ||
# ENABLE: # If you use ENABLE variable, all other languages/formats/tooling-formats will be disabled by default | ||
# ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default | ||
DISABLE: | ||
- C | ||
- COPYPASTE # abusive copy-pastes | ||
- SPELL # spelling mistakes | ||
DISABLE_LINTERS: | ||
- CPP_CPPLINT | ||
- BASH_EXEC | ||
- BASH_SHFMT | ||
- JSON_PRETTIER | ||
- YAML_V8R | ||
- YAML_PRETTIER | ||
SHOW_ELAPSED_TIME: true | ||
FILEIO_REPORTER: false | ||
GITHUB_COMMENT_REPORTER: false | ||
UPDATED_SOURCES_REPORTER: false | ||
PRINT_ALPACA: false # Don't print ASCII alpaca in the log |
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
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,3 +1,5 @@ | ||
# O2Physics | ||
|
||
Documentation for the ALICE Analysis framework is available at: | ||
|
||
https://aliceo2group.github.io/analysis-framework/ | ||
<https://aliceo2group.github.io/analysis-framework/> |
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