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

Improve SHA mismatch error message #5315

Closed
1 task done
TrentSteenholdt-Insight opened this issue Feb 22, 2024 · 3 comments · Fixed by #5316 or #5314
Closed
1 task done

Improve SHA mismatch error message #5315

TrentSteenholdt-Insight opened this issue Feb 22, 2024 · 3 comments · Fixed by #5316 or #5314
Labels
enhancement New feature or request O: backlog 🤖 Backlog, stale ignores this label

Comments

@TrentSteenholdt-Insight

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Super Linter v6 on Pull Request pipeline run fails with

2024-02-22 01:35:33 [FATAL] The GITHUB_SHA reference (xxxx) doesn't exist in this Git repository

---
name: PR

on:
  pull_request:
    branches:
      - main

env:
  PSRULE_DIRECTORY: ./

jobs:
  linting:
    name: Linting
    runs-on: ubuntu-latest

    permissions:
      contents: read
      packages: read
      statuses: write

    steps:
      - name: Check-Out Repository
        uses: actions/checkout@v4

        # Linting
      - name: Run GitHub Super-Linter
        uses: super-linter/super-linter@v6
        env:
          DEFAULT_BRANCH: 'main'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          VALIDATE_JSON: true
          VALIDATE_MARKDOWN: true
          VALIDATE_POWERSHELL: true
          VALIDATE_YAML: true
          FILTER_REGEX_EXCLUDE: ^.*/src/modules/[^/]+/.*\.md$

Expected Behavior

In version v5, the same YAML works fine

---
name: PR

on:
  pull_request:
    branches:
      - main

env:
  PSRULE_DIRECTORY: ./

jobs:
  linting:
    name: Linting
    runs-on: ubuntu-latest

    permissions:
      contents: read
      packages: read
      statuses: write

    steps:
      - name: Check-Out Repository
        uses: actions/checkout@v4

        # Linting
      - name: Run GitHub Super-Linter
        uses: super-linter/super-linter@v5
        env:
          DEFAULT_BRANCH: 'main'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          VALIDATE_JSON: true
          VALIDATE_MARKDOWN: true
          VALIDATE_POWERSHELL: true
          VALIDATE_YAML: true
          FILTER_REGEX_EXCLUDE: ^.*/src/modules/[^/]+/.*\.md$

Super-Linter version

v6 latest (v6.2.0)

Relevant log output

/usr/bin/docker run --name ghcriosuperlintersuperlinterv620_2fa901 --label 72f98f --workdir /github/workspace --rm -e "PSRULE_DIRECTORY" -e "INFRA_WORKING_DIRECTORY" -e "github_user_name" -e "github_email" -e "github_commit_message" -e "github_pr_number" -e "github_pr_repo" -e "DEFAULT_BRANCH" -e "GITHUB_TOKEN" -e "VALIDATE_JSON" -e "VALIDATE_MARKDOWN" -e "VALIDATE_POWERSHELL" -e "VALIDATE_YAML" -e "FILTER_REGEX_EXCLUDE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/azure-landing-zones-vending-machine/azure-landing-zones-vending-machine":"/github/workspace" ghcr.io/super-linter/super-linter:v6.2.0
Super-Linter initialization
  --------------------------------------------------------------------------------
  
                                /@@#///////@@/(@//@%/(@.@(       @@
                            @@//////////////////////////////#*  @@@
                          @////@//(///////////@@@@@///@//@/@**//@@(
                        @///////@///////////////@@@@    (           @,
                       @/(&/@////////////////////                     @
                      @////////////////////////@@                      @
                    @%////////(//////////%/////&@            @@       *,@           ______________
               @@@@@/@/#/////(&//////////////////                       .@         /              \
          *@@@@@.    .%///(//@//////////////////&.   .@@,                 @%      / Don't mind me  \
        @@%           .&@&&/@.@//&/////(//////////    @@@@@@@@@         .. &@    / I'm just looking \
      @@%               @@@@@   @&/////////////////#   @/       V  @@/ ,@@@ @   <  for some trash... |
  @@@%                   @@@@        .%@@@@//////#@ @   @@         @     .,.     \__________________/
                                            @@@/@(  (@@@@% @/\      %
                                             @@@@(    .     .@@/\   #
                                               @                  %@%
  
  --------------------------------------------------------------------------------
  2024-02-22 01:35:32 [INFO]   ---------------------------------------------
  2024-02-22 01:35:32 [INFO]   --- GitHub Actions Multi Language Linter ----
  2024-02-22 01:35:32 [INFO]    - Image Creation Date: 2024-02-20T21:39:00Z
  2024-02-22 01:35:32 [INFO]    - Image Revision: 25003d0370b45d97187597838ecb9fdadfc08aea
  2024-02-22 01:35:32 [INFO]    - Image Version: 25003d0370b45d97187597838ecb9fdadfc08aea
  2024-02-22 01:35:32 [INFO]   ---------------------------------------------
  2024-02-22 01:35:32 [INFO]   ---------------------------------------------
  2024-02-22 01:35:32 [INFO]   The Super-Linter source code can be found at:
  2024-02-22 01:35:32 [INFO]    - https://github.com/super-linter/super-linter
  2024-02-22 01:35:32 [INFO]   ---------------------------------------------
  2024-02-22 01:35:32 [INFO]   - Validating all files in code base...
  chktex: chktex: WARNING -- Could not find global resource file.
  ChkTeX v1.7.8 - Copyright 1995-96 Jens T. Berger Thielemann.
  Compiled with POSIX extended regex support.
  rubocop: 1.60.2
  perl: 
  This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-thread-multi
  
  Copyright 1987-2023, Larry Wall
  
  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5 source kit.
  
  Complete documentation for Perl, including FAQ lists, should be found on
  this system using "man perl" or "perldoc perl".  If you have access to the
  Internet, point your browser at https://www.perl.org/, the Perl Home Page.
  xmllint: xmllint: using libxml version 21106
     compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 HTTP DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Schemas Schematron Modules Debug Zlib Lzma 
  ansible-lint: ansible-lint 24.2.0 using ansible-core:2.16.3 ansible-compat:4.1.11 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  eslint: v8.56.0
  markdownlint: 0.39.0
  snakefmt: snakefmt, version 0.10.0
  cpplint: Cpplint fork (https://github.com/cpplint/cpplint)
  cpplint 1.6.1
  Python 3.12.2 (main, Feb  7 2024, 22:13:24) [GCC 13.2.1 20231014]
  editorconfig-checker: 2.7.2
  gitleaks: v8.18.2
  phpstan: PHPStan - PHP Static Analysis Tool 1.10.48
  dotenv-linter: dotenv-linter 3.3.0
  asl-validator: 3.8.2
  actionlint: 1.6.26
  installed by building from source
  built with go1.21.1 compiler for linux/amd64
  tekton-lint: 1.0.0-beta.9
  terrascan: version: v1.18.11
  terraform: Terraform v1.7.3
  on linux_amd64
  2024/02/20 18:33:30 traces export: Post "http:///dev/otel-grpc.sock": http: no Host in request URL
  2024/02/20 18:33:30 traces export: Post "http:///dev/otel-grpc.sock": http: no Host in request URL
  clippy: clippy 0.1.72
  R: R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
  Copyright (C) 2023 The R Foundation for Statistical Computing
  Platform: x86_64-pc-linux-musl (64-bit)
  
  R is free software and comes with ABSOLUTELY NO WARRANTY.
  You are welcome to redistribute it under the terms of the
  GNU General Public License versions 2 or 3.
  For more information about these matters see
  https://www.gnu.org/licenses/.
  rustfmt: rustfmt 1.6.0-stable ( )
  shellcheck: ShellCheck - shell script analysis tool
  version: 0.9.0
  license: GNU General Public License, version 3
  website: https://www.shellcheck.net
  jscpd: 3.5.10
  black: black, 24.2.0 (compiled: no)
  Python (CPython) 3.12.2
  prettier: 3.2.5
  php: PHP 8.2.15 (cli) (built: Jan 18 2024 16:40:05) (NTS)
  Copyright (c) The PHP Group
  Zend Engine v4.2.15, Copyright (c) Zend Technologies
  textlint: v14.0.3
  npm-groovy-lint: GroovyLint: Successfully processed CodeNarc: 
  CodeNarc version 3.3.0
  npm-groovy-lint version 14.2.2
  
  Embeds:
  CodeNarc version 3.3.0
  - Groovy version 3.0.9 (superlite)
  renovate-config-validator: (node:239) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  (Use `node --trace-deprecation ...` to show where the warning was created)
  37.202.2
  golangci-lint: golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a0 on 2024-02-15T20:35:23Z
  kubeconform: v0.6.4
  golangci-lint: golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a0 on 2024-02-15T20:35:23Z
  gherkin-lint: Version command not supported
  eslint: v8.56.0
  scalafmt: scalafmt 3.7.17
  stylelint: 15.11.0
  sqlfluff: sqlfluff, version 2.3.5
  bash-exec: Version command not supported
  google-java-format: google-java-format: Version 1.19.2
  phpcs: PHP_CodeSniffer version 3.8.0 (stable) by Squiz and PHPCSStandards
  terragrunt: terragrunt version v0.55.2
  psalm: Psalm 5.22.1@e9dad66e11274315dac27e08349c628c7d6a1a43
  pylint: pylint 3.0.3
  astroid 3.0.3
  Python 3.12.2 (main, Feb  7 2024, 22:13:24) [GCC 13.2.1 20231014]
  shfmt: v3.8.0
  snakemake: 8.4.9
  arm-ttk: ModuleVersion = 0.24
  pwsh: PowerShell 7.4.1
  mypy: mypy 1.8.0 (compiled: yes)
  eslint: v8.56.0
  coffeelint: 5.2.11
  tflint: TFLint version 0.50.3
  + ruleset.terraform (0.5.0-bundled)
  cfn-lint: cfn-lint 0.85.2
  flake8: 7.0.0 (mccabe: 0.7.0, pycodestyle: 2.11.1, pyflakes: 3.2.0) CPython 3.12.2 on
  Linux
  spectral: 6.11.0
  clj-kondo: clj-kondo v2024.02.12
  eslint: v8.56.0
  ts-standard: 12.0.2
  eslint: v8.56.0
  protolint: protolint version 0.47.5(80ba08f)
  raku: Welcome to Rakudo™ v2023.11.
  Implementing the Raku® Programming Language v6.d.
  Built on MoarVM version 2023.11.
  prettier: 3.2.5
  hadolint: Haskell Dockerfile Linter 2.12.0
  checkstyle: Checkstyle version: 10.13.0
  clang-format: clang-format version 17.0.5 (https://github.com/llvm/llvm-project.git 98bfdac5ce82d1679f8af9a57501471812ab68d7)
  ktlint: 1.1.1
  yamllint: yamllint 1.35.1
  dart: Dart SDK version: 3.3.0 (stable) (Tue Feb 13 10:25:19 2024 +0000) on "linux_x64"
  isort: 
                   _                 _
                  (_) ___  ___  _ __| |_
                  | |/ _/ / _ \/ '__  _/
                  | |\__ \/\_\/| |  | |_
                  |_|\___/\___/\_/   \_/
  
        isort your imports, so you don't have to.
  
                      VERSION 5.13.2
  dotnet: 8.0.101
  eslint: v8.56.0
  rustfmt: rustfmt 1.6.0-stable ( )
  htmlhint: 1.1.4
  rustfmt: rustfmt 1.6.0-stable ( )
  sql-lint: 1.0.0
  checkov: 3.2.22
  lua: Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
  standard: 17.1.0
  2024-02-22 01:35:32 [INFO]   --------------------------------------------
  2024-02-22 01:35:32 [INFO]   Gathering GitHub information...
  2024-02-22 01:35:32 [INFO]   Successfully validated GITHUB_WORKSPACE: /github/workspace
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_EVENT_PATH: /github/workflow/event.json]
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_SHA: f949888b8ab4e8f7b1eb5394da82dde922e00a02
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_ORG: Insight-Services-APAC
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_REPO: azure-landing-zones-vending-machine
  2024-02-22 01:35:32 [INFO]   The default branch for this repository is set to: main
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_TOKEN.
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_REPOSITORY: Insight-Services-APAC/azure-landing-zones-vending-machine
  2024-02-22 01:35:32 [INFO]   Successfully found GITHUB_RUN_ID 7998125238
  2024-02-22 01:35:32 [INFO]   --------------------------------------------
  2024-02-22 01:35:32 [INFO]   Validating the configuration
  .git
  2024-02-22 01:35:33 [FATAL]   The GITHUB_SHA reference (05bce21b8e4551cc59985802154e3184fe1bad4f) doesn't exist in this Git repository

Steps To Reproduce

  1. Run above YAML in pipeline on GitHub Actions
  2. SHA mismatch on PR when running v6
  3. SHA matches on PR when running v5

Anything else?

No response

@TrentSteenholdt-Insight TrentSteenholdt-Insight added the bug Something isn't working label Feb 22, 2024
@echoix
Copy link

echoix commented Feb 22, 2024

I got the same thing when upgrading a repo to v6 the other week. The error message isn't clear at all for this, but the SHA reference is your commit's SHA, the one that the workflow is running for.

So, see the resolution of another issue today, #5313, it's the same problem.

A similar report here: #5239

@ferrarimarco
Copy link
Collaborator

Hi! Given the recurrence of this kind of report, we should probably enhance the error message. Thanks for reporting this!

@ferrarimarco ferrarimarco added enhancement New feature or request O: backlog 🤖 Backlog, stale ignores this label and removed bug Something isn't working labels Feb 22, 2024
@ferrarimarco ferrarimarco changed the title SHA mismatch with super-linter@v6 (working in v5) Improve SHA mismatch error message Feb 22, 2024
ferrarimarco added a commit that referenced this issue Feb 22, 2024
Emit a hopefully more helpful error message when the Git ref doesn't
exist. The error message is the same we use when getting changed files
only: it suggests checking that repository clone is not shallow, and
that the full history is available. Additionally, when running on
GitHub Actions, it also suggests checking the fetch-depth option of the
actions/checkout step.

Fix #5315
@ferrarimarco
Copy link
Collaborator

#5316 should take care of this.

ferrarimarco added a commit that referenced this issue Feb 22, 2024
Emit a hopefully more helpful error message when the Git ref doesn't
exist. The error message is the same we use when getting changed files
only: it suggests checking that repository clone is not shallow, and
that the full history is available. Additionally, when running on
GitHub Actions, it also suggests checking the fetch-depth option of the
actions/checkout step.

Fix #5315
ferrarimarco added a commit that referenced this issue Feb 22, 2024
Emit a hopefully more helpful error message when the Git ref doesn't
exist. The error message is the same we use when getting changed files
only: it suggests checking that repository clone is not shallow, and
that the full history is available. Additionally, when running on
GitHub Actions, it also suggests checking the fetch-depth option of the
actions/checkout step.

Fix #5315
ferrarimarco added a commit that referenced this issue Feb 27, 2024
Emit a hopefully more helpful error message when the Git ref doesn't
exist. The error message is the same we use when getting changed files
only: it suggests checking that repository clone is not shallow, and
that the full history is available. Additionally, when running on
GitHub Actions, it also suggests checking the fetch-depth option of the
actions/checkout step.

Fix #5315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request O: backlog 🤖 Backlog, stale ignores this label
Projects
None yet
3 participants