fix: replace raw echo with output helpers in check #2922
Workflow file for this run
This file contains hidden or 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
| --- # Linting of pull requests | |
| # Maintain in repo: funfair-server-template | |
| name: "PR: Lint" | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened, ready_for_review, unlocked] | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| concurrency: | |
| group: ${{github.workflow}}-${{github.ref}} | |
| cancel-in-progress: true | |
| env: | |
| HEAD_REF: ${{github.head_ref}} | |
| BASE_REF: ${{github.base_ref}} | |
| REPO_STATUS: private | |
| jobs: | |
| info: | |
| if: endsWith(github.repository, '-template') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Info" | |
| uses: actions/github-script@v9.0.0 | |
| with: | |
| script: | | |
| core.info(`Branch: ${process.env.HEAD_REF}`); | |
| core.info(`Base Branch: ${process.env.BASE_REF}`); | |
| core.info(`Repo: ${context.repo.owner}/${context.repo.repo}`); | |
| core.info(`Owner: ${context.repo.owner}`); | |
| include-changelog-entry: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 2 | |
| - name: "Fetch Base Branch" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| shell: bash | |
| run: git fetch origin ${{github.base_ref}} --depth=1 | |
| - name: "Diff Changes" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| shell: bash | |
| run: echo "CHANGES=$(git diff --exit-code --no-patch --merge-base origin/main CHANGELOG.md 2> /dev/null && echo 0 || echo $?)" >> "$GITHUB_ENV" | |
| - name: "Report unchanged" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) && env.CHANGES == '0' | |
| uses: actions/github-script@v9.0.0 | |
| with: | |
| script: | | |
| core.setFailed('Changelog has not changed') | |
| change-log-entry-is-in-unreleased: | |
| if: github.event.pull_request.draft == false | |
| # As LibGit2Sharp doesn't work on 20.04 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check Required Secrets" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| shell: bash | |
| run: | | |
| if [ -z "${{secrets.SOURCE_PUSH_TOKEN}}" ]; then | |
| echo "::error::SOURCE_PUSH_TOKEN is required but not set" | |
| exit 1 | |
| fi | |
| - name: "Install dotnet" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| uses: ./.github/actions/dotnet-install | |
| with: | |
| GITHUB_TOKEN: ${{secrets.SOURCE_PUSH_TOKEN}} | |
| NUGET_PUBLIC_RESTORE_FEED_CACHE: ${{vars.NUGET_BAGET_CACHE}} | |
| NUGET_PUBLIC_RESTORE_FEED: ${{vars.NUGET_PUBLIC_RESTORE_FEED || 'https://api.nuget.org/v3/index.json'}} | |
| NUGET_ADDITIONAL_RESTORE_FEED_RELEASE_CACHE: "" | |
| NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE_CACHE: "" | |
| NUGET_ADDITIONAL_RESTORE_FEED_RELEASE: "" | |
| NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE: "" | |
| - name: "Install Changelog tool" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| uses: ./.github/actions/dotnet-tool | |
| with: | |
| TOOL_NAME: "Credfeto.ChangeLog.Cmd" | |
| TOOL_VERSION: "latest" | |
| - name: "Check Changelog" | |
| if: (github.actor != 'dependabot[bot]' && !endsWith(github.repository , '-template')) | |
| uses: ./.github/actions/dotnet-tool-run | |
| with: | |
| WORKING_DIRECTORY: ${{github.workspace}} | |
| TOOL_NAME: "changelog" | |
| TOOL_ARGUMENTS: "--changelog \"${{github.workspace}}/CHANGELOG.md\" --check-insert \"origin/${{github.base_ref}}\"" | |
| does-not-contain-secrets: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check for leaks" | |
| uses: trufflesecurity/trufflehog@v3.95.6 | |
| id: trufflehog | |
| with: | |
| path: "${{ github.workspace }}" | |
| base: "${{ github.event.repository.default_branch }}" | |
| head: HEAD | |
| extra_args: --debug --only-verified | |
| - name: "Scan Results Status" | |
| if: steps.trufflehog.outcome == 'failure' | |
| run: exit 1 | |
| has-no-merge-conflicts: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for merge conflicts" | |
| uses: ./.github/actions/check-no-merge-conflicts | |
| has-no-file-or-folder-case-sensitivity-issues: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for case conflicts" | |
| uses: ./.github/actions/check-no-case-sensitivity-conflicts | |
| no-ignored-files: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for ignored files" | |
| uses: ./.github/actions/check-no-ignored-files | |
| dependency-review: | |
| # Check that there are no dependencies with security problems in the PR | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - if: env.REPO_STATUS == '' | |
| name: "Check repo visibility" | |
| uses: ./.github/actions/check-repo-visibility | |
| id: visibility | |
| with: | |
| github-token: ${{github.token}} | |
| - name: "Checkout Source" | |
| if: steps.visibility.outputs.is_public == 'true' | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: "Dependency Review" | |
| if: steps.visibility.outputs.is_public == 'true' | |
| uses: actions/dependency-review-action@v5.0.0 | |
| no-merge-commits: | |
| # Check that there are no merge commits in the PR | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for merge commits" | |
| uses: ./.github/actions/check-no-merge-commits | |
| valid-changelog: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Install dotnet" | |
| uses: ./.github/actions/dotnet-install | |
| with: | |
| GITHUB_TOKEN: ${{secrets.SOURCE_PUSH_TOKEN}} | |
| NUGET_PUBLIC_RESTORE_FEED_CACHE: ${{vars.NUGET_BAGET_CACHE}} | |
| NUGET_PUBLIC_RESTORE_FEED: ${{vars.NUGET_PUBLIC_RESTORE_FEED || 'https://api.nuget.org/v3/index.json'}} | |
| NUGET_ADDITIONAL_RESTORE_FEED_RELEASE_CACHE: "" | |
| NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE_CACHE: "" | |
| NUGET_ADDITIONAL_RESTORE_FEED_RELEASE: "" | |
| NUGET_ADDITIONAL_RESTORE_FEED_PRERELEASE: "" | |
| - name: "Install Changelog tool" | |
| uses: ./.github/actions/dotnet-tool | |
| with: | |
| TOOL_NAME: "Credfeto.ChangeLog.Cmd" | |
| TOOL_VERSION: "latest" | |
| - name: "Check Changelog" | |
| uses: ./.github/actions/dotnet-tool-run | |
| with: | |
| WORKING_DIRECTORY: ${{github.workspace}} | |
| TOOL_NAME: "changelog" | |
| TOOL_ARGUMENTS: "--changelog \"${{github.workspace}}/CHANGELOG.md\" --lint" | |
| lint-code: | |
| if: |- | |
| github.event.pull_request.draft == false && | |
| ( !startsWith(github.head_ref, 'release/') && !startsWith(github.head_ref, 'hotfix/') ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Set Active Environment" | |
| shell: bash | |
| run: | | |
| { | |
| echo "ACTIVE_RUNNER_NAME=${{runner.name}}" | |
| echo "ACTIVE_HOSTNAME=$HOSTNAME" | |
| echo "ACTIVE_USER=$USER" | |
| } >> "$GITHUB_ENV" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check Required Secrets" | |
| shell: bash | |
| run: | | |
| if [ -z "${{secrets.SOURCE_PUSH_TOKEN}}" ]; then | |
| echo "::error::SOURCE_PUSH_TOKEN is required but not set" | |
| exit 1 | |
| fi | |
| - name: "Run Linter" | |
| uses: super-linter/super-linter@v8.7.0 | |
| env: | |
| CLOUDFORMATION_CONFIG_FILE: .cfnlintrc.yaml | |
| DEFAULT_BRANCH: main | |
| ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true | |
| GITHUB_ACTIONS_CONFIG_FILE: actionlint.yaml | |
| GITHUB_TOKEN: ${{secrets.SOURCE_PUSH_TOKEN}} | |
| MULTI_STATUS: true | |
| SAVE_SUPER_LINTER_SUMMARY: true | |
| SQLFLUFF_CONFIG_FILE: .sqlfluff | |
| VALIDATE_ALL_CODEBASE: false | |
| VALIDATE_ANSIBLE: true | |
| VALIDATE_BASH: true | |
| VALIDATE_CLOUDFORMATION: true | |
| VALIDATE_CSS: true | |
| VALIDATE_DOCKERFILE: true | |
| VALIDATE_DOCKERFILE_HADOLINT: true | |
| VALIDATE_ENV: true | |
| VALIDATE_GITHUB_ACTIONS: true | |
| VALIDATE_JSON: true | |
| VALIDATE_MD: true | |
| VALIDATE_POWERSHELL: true | |
| VALIDATE_PYTHON: true | |
| VALIDATE_PYTHON_PYLINT: true | |
| VALIDATE_SQLFLUFF: true | |
| VALIDATE_TYPESCRIPT_ES: true | |
| VALIDATE_XML: true | |
| VALIDATE_YAML: true |