-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
Applying fixes does not work #481
Comments
Thanks for this feedback, I think you're the first to check other cases than Commit within the same repo ! If you have proposition of fixes, please be my guest to make a PR |
Allowing fixes for push events can be done simply by replacing I don't have any further suggestions on the other errors, unfortunately. |
@vkucera please make a PR, that will make you a contributor :) |
I followed the instructions at https://nvuillam.github.io/mega-linter/contributing/
Do you have an idea where this error comes from? |
Did you install https://www.npmjs.com/package/markdown-table-formatter ? |
and do you have latest node.js version ? |
No, I didn't. The instructions mention installation of
No I don't. My version is v10.19.0 (available in Ubuntu 20.04). Btw, the line |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
not stale |
Agreed... sorry my rent-paying job is very time consuming these days ! |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Hello What I am trying to do is analyzing the newly changed files against the .editorconfig file at the root of my repository and if there are any broken properties, fixing them automatically(either via a commit or a pr, doesn't matter). When I create a feature branch, create an issue and create a PR, the editorconfig scan gives an error as expected and the steps about creating a pr and fixing things are skipped. I am adding screenshots and my workflow to describe the issue ina better way. Am I missing anything? Looking forward for your help @nvuillam Thanks ---
# Mega-Linter GitHub Action configuration file
# More info at https://nvuillam.github.io/mega-linter
name: Mega-Linter
on:
# Trigger mega-linter at every push. Action will also be visible from Pull Requests to master
#push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
pull_request:
branches: [master, develop]
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)
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: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
jobs:
# Cancel duplicate jobs: https://github.com/fkirc/skip-duplicate-actions#option-3-cancellation-only
cancel_duplicates:
name: Cancel duplicate jobs
runs-on: ubuntu-latest
steps:
- uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
build:
name: Mega-Linter
runs-on: ubuntu-latest
steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0
# Mega-Linter
- name: Mega-Linter
id: ml
# You can override Mega-Linter flavor used to have faster performances
# More info at https://nvuillam.github.io/mega-linter/flavors/
uses: nvuillam/mega-linter@v4
env:
# All available variables are described in documentation
# https://nvuillam.github.io/mega-linter/configuration/
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: develop
#VALIDATE_ALL_CODEBASE: ${{ 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
# Upload Mega-Linter artifacts
- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Mega-Linter reports
path: |
report
mega-linter.log
# 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)
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[Mega-Linter] Apply linters automatic fixes"
title: "[Mega-Linter] Apply linters automatic fixes"
labels: 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)
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
# Push new commit if applicable (for now works only on PR from same repository, not from forks)
- name: Prepare commit
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/master' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/master' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "[Mega-Linter] Apply linters fixes"
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
@dgokcin to apply fixes with a new PR or commit, there must be no blocking lint error on the Mega-Linter step If you want to apply fixes while there are still not auto-fixable lint errors, you can copy the content of "updated_files" in report artifact |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Hi @nvuillam , I am wondering whether there has been any progress on this. Especially the option to apply formatting as a PR would be very much appreciated. |
Not yet, sorry |
See #2125. |
Describe the bug
The only way of applying fixes that seems to work is the commit mode on pull request events from one branch to another in the same repository. All other cases fail for various reasons.
To Reproduce
APPLY_FIXES_EVENT
andAPPLY_FIXES_MODE
.Expected behaviour
Fixes are applied as commit or pull request (according to
APPLY_FIXES_MODE
) for push or pull request events (according toAPPLY_FIXES_EVENT
).Additional context
github.event.pull_request.head.repo.full_name == github.repository
which can never be satisfied becausegithub.event.pull_request
exists only for pull request event.peter-evans/create-pull-request
action complains with:I tried to run the workflow with the branch
HEAD
checked out using:ref: ${{ github.event.pull_request.head.sha }}
in thecheckout
action but that makes the Mega-Linter runner fail with:where
<SHA>
is a commit SHA which is different from the branchHEAD
at which the repository was initially checked out.(Could it be the commit with the fixes?)
How about pull requests between repositories?
Besides fixing these issues it would also be very useful if the fixes could be applied in pull request events from a fork to an upstream repository, since that is the way pull requests are mostly used.
I don't know if it is related, but for completeness
For tests of pull requests from a fork to an upstream repository, this warning always appears:
where
<SHA>
corresponds to the merge commit created by the checkout action.This is then followed by this error for each linter:
The text was updated successfully, but these errors were encountered: