Repository navigation
docs(ai): self-assign only own pull requests, never dependency updates #2572
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}}" | |
| jobs: | |
| repo-info: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_template: "${{steps.visibility.outputs.is-template}}" | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check repo visibility" | |
| id: visibility | |
| uses: ./.github/actions/check-repo-visibility | |
| info: | |
| needs: [repo-info] | |
| if: needs.repo-info.outputs.is_template == 'true' | |
| 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@3a2844b7e9c422d3c10d287c895573f7108da1b3 # 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}`); | |
| await core.summary | |
| .addHeading('Info') | |
| .addTable([ | |
| [{data: 'Property', header: true}, {data: 'Value', header: true}], | |
| ['Branch', `${process.env.HEAD_REF}`], | |
| ['Base Branch', `${process.env.BASE_REF}`], | |
| ['Repo', `${context.repo.owner}/${context.repo.repo}`], | |
| ['Owner', `${context.repo.owner}`], | |
| ]) | |
| .write(); | |
| # @@required: merge | |
| include-changelog-entry: | |
| if: |- | |
| github.event.pull_request.draft == false && | |
| !contains(github.event.pull_request.labels.*.name, 'Changelog Not Required') | |
| 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]' | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check repo visibility" | |
| id: visibility | |
| if: github.actor != 'dependabot[bot]' | |
| uses: ./.github/actions/check-repo-visibility | |
| - name: "Diff Changes" | |
| if: (github.actor != 'dependabot[bot]' && steps.visibility.outputs.is-template != 'true') | |
| shell: bash | |
| run: | | |
| diff_output=$(git diff --exit-code --no-patch --merge-base "origin/${BASE_REF}" CHANGELOG.md 2>&1) && diff_exit=0 || diff_exit=$? | |
| case "${diff_exit}" in | |
| 0|1) | |
| echo "CHANGES=${diff_exit}" >> "$GITHUB_ENV" | |
| ;; | |
| *) | |
| echo "::error::git diff against origin/${BASE_REF//[$'\r\n']/ } failed (exit ${diff_exit}): ${diff_output//[$'\r\n']/ }" | |
| exit "${diff_exit}" | |
| ;; | |
| esac | |
| - name: "Report unchanged" | |
| if: (github.actor != 'dependabot[bot]' && steps.visibility.outputs.is-template != 'true') && env.CHANGES == '0' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| core.setFailed('❌ Changelog has not changed') | |
| # @@required: merge | |
| change-log-entry-is-in-unreleased: | |
| if: |- | |
| github.event.pull_request.draft == false && | |
| github.actor != 'dependabot[bot]' | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check repo visibility" | |
| id: visibility | |
| uses: ./.github/actions/check-repo-visibility | |
| - name: "Check Required Secrets" | |
| if: steps.visibility.outputs.is-template != 'true' | |
| uses: ./.github/actions/check-required-secret | |
| with: | |
| secret-name: "SOURCE_PUSH_TOKEN" | |
| secret-value: "${{secrets.SOURCE_PUSH_TOKEN}}" | |
| - name: "Install dotnet" | |
| if: steps.visibility.outputs.is-template != 'true' | |
| 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: steps.visibility.outputs.is-template != 'true' | |
| uses: ./.github/actions/dotnet-tool | |
| with: | |
| tool-name: "Credfeto.ChangeLog.Cmd" | |
| tool-version: "latest" | |
| - name: "Check Changelog" | |
| if: steps.visibility.outputs.is-template != 'true' | |
| 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}} | |
| untrusted-output: "true" | |
| # @@required: merge | |
| changelog-template-unreleased-is-empty: | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check repo visibility" | |
| id: visibility | |
| uses: ./.github/actions/check-repo-visibility | |
| - name: "Check Required Secrets" | |
| if: steps.visibility.outputs.is-template == 'true' | |
| uses: ./.github/actions/check-required-secret | |
| with: | |
| secret-name: "SOURCE_PUSH_TOKEN" | |
| secret-value: "${{secrets.SOURCE_PUSH_TOKEN}}" | |
| - name: "Install dotnet" | |
| if: steps.visibility.outputs.is-template == 'true' | |
| 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: steps.visibility.outputs.is-template == 'true' | |
| uses: ./.github/actions/dotnet-tool | |
| with: | |
| tool-name: "Credfeto.ChangeLog.Cmd" | |
| tool-version: "latest" | |
| - name: "Check Unreleased is headings only" | |
| if: steps.visibility.outputs.is-template == 'true' | |
| shell: bash | |
| run: | | |
| # Untrusted text is printed between stop-commands markers so it cannot issue workflow commands. | |
| print_untrusted() { | |
| local token | |
| token=$(head -c 32 /dev/urandom | base64 -w0 | tr -dc 'A-Za-z0-9') | |
| echo "::stop-commands::$token" | |
| printf '%s\n' "$1" | |
| echo "::$token::" | |
| } | |
| output=$(timeout 10m dotnet tool run --allow-roll-forward changelog --changelog "$CHANGELOG_FILE" --un-released 2>"$CHANGELOG_STDERR_FILE") || { | |
| print_untrusted "$output"$'\n'"$(cat "$CHANGELOG_STDERR_FILE")" | |
| echo "::error::❌ Changelog tool failed to read the [Unreleased] section" | |
| exit 1 | |
| } | |
| if ! grep -qxF 'Unreleased Content:' <<< "$output"; then | |
| print_untrusted "$output" | |
| echo "::error::❌ Changelog tool output has no 'Unreleased Content:' line" | |
| exit 1 | |
| fi | |
| content=$(sed '0,/^Unreleased Content:$/d' <<< "$output" | grep -v '^[[:space:]]*$' || true) | |
| if [ -n "$content" ]; then | |
| print_untrusted "$content" | |
| echo "::error::❌ Template changelog [Unreleased] section must contain headings only" | |
| exit 1 | |
| fi | |
| echo "✅ Template changelog [Unreleased] section contains headings only" | |
| env: | |
| CHANGELOG_FILE: "${{github.workspace}}/CHANGELOG.md" | |
| CHANGELOG_STDERR_FILE: "${{runner.temp}}/changelog-unreleased-stderr.txt" | |
| TMP: "${{runner.temp}}" | |
| # @@required: merge | |
| changelog-has-no-placeholders: | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check Required Secrets" | |
| uses: ./.github/actions/check-required-secret | |
| with: | |
| secret-name: "SOURCE_PUSH_TOKEN" | |
| secret-value: "${{secrets.SOURCE_PUSH_TOKEN}}" | |
| - 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 Unreleased has no placeholders" | |
| shell: bash | |
| run: | | |
| # Untrusted text is printed between stop-commands markers so it cannot issue workflow commands. | |
| print_untrusted() { | |
| local token | |
| token=$(head -c 32 /dev/urandom | base64 -w0 | tr -dc 'A-Za-z0-9') | |
| echo "::stop-commands::$token" | |
| printf '%s\n' "$1" | |
| echo "::$token::" | |
| } | |
| output=$(timeout 10m dotnet tool run --allow-roll-forward changelog --changelog "$CHANGELOG_FILE" --un-released 2>"$CHANGELOG_STDERR_FILE") || { | |
| print_untrusted "$output"$'\n'"$(cat "$CHANGELOG_STDERR_FILE")" | |
| echo "::error::❌ Changelog tool failed to read the [Unreleased] section" | |
| exit 1 | |
| } | |
| if ! grep -qxF 'Unreleased Content:' <<< "$output"; then | |
| print_untrusted "$output" | |
| echo "::error::❌ Changelog tool output has no 'Unreleased Content:' line" | |
| exit 1 | |
| fi | |
| # A bullet (-, *, +, 1. or 1)) whose first word is TBD, optionally wrapped in emphasis, backticks, brackets or parentheses. | |
| bullet_tbd="^[[:space:]]*([-*+]|[0-9]+[.)])[[:space:]]*[*_\`[(]*TBD[]*_\`)]*([^[:alnum:]_]|\$)" | |
| # A bullet that is only TODO or WIP (same wrappers), or that word followed by ':' or ' - ', so real entries such as | |
| # 'TODO list support' or 'WIP-limit setting' are not placeholders. | |
| bullet_todo_wip="^[[:space:]]*([-*+]|[0-9]+[.)])[[:space:]]*[*_\`[(]*(TODO|WIP)[]*_\`)]*([[:space:]]*\$|:| - )" | |
| finalize_tbd='TBD - to be finalized after review' | |
| placeholders=$(sed '0,/^Unreleased Content:$/d' <<< "$output" | grep -iE -e "$bullet_tbd" -e "$bullet_todo_wip" -e "$finalize_tbd" || true) | |
| if [ -n "$placeholders" ]; then | |
| print_untrusted "$placeholders" | |
| echo "::error::❌ Contains placeholder content" | |
| exit 1 | |
| fi | |
| echo "✅ Changelog [Unreleased] section contains no placeholder content" | |
| env: | |
| CHANGELOG_FILE: "${{github.workspace}}/CHANGELOG.md" | |
| CHANGELOG_STDERR_FILE: "${{runner.temp}}/changelog-unreleased-stderr.txt" | |
| TMP: "${{runner.temp}}" | |
| # @@required: merge | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check for leaks" | |
| id: trufflehog | |
| uses: trufflesecurity/trufflehog@3bd2b5887eb0efb8fa18bfd1d296032924e4ffdc # v3.99.9 | |
| with: | |
| path: "${{github.workspace}}" | |
| base: "${{github.event.repository.default_branch}}" | |
| head: "HEAD" | |
| extra_args: "--debug --only-verified" | |
| # @@required: merge | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for merge conflicts" | |
| uses: ./.github/actions/check-no-merge-conflicts | |
| # @@required: merge | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for case conflicts" | |
| uses: ./.github/actions/check-no-case-sensitivity-conflicts | |
| # @@required: merge | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for ignored files" | |
| uses: ./.github/actions/check-no-ignored-files | |
| with: | |
| extra-excluded-files: "${{endsWith(github.repository, 'global-pre-commit') && '.pre-commit-config.yaml' || ''}}" | |
| # @@required: merge | |
| no-prohibited-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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for prohibited files" | |
| uses: ./.github/actions/check-no-prohibited-files | |
| # @@required: merge | |
| no-expressions-in-scripts: | |
| # Check that no workflow expression is used inside a run: or script: body | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for expressions in scripts" | |
| uses: ./.github/actions/check-no-expressions-in-scripts | |
| # @@required: merge | |
| 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" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check repo visibility" | |
| id: visibility | |
| uses: ./.github/actions/check-repo-visibility | |
| - name: "Dependency Review" | |
| if: steps.visibility.outputs.is-public == 'true' | |
| uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 | |
| # @@required: merge | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check for merge commits" | |
| uses: ./.github/actions/check-no-merge-commits | |
| # @@required: merge | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: "Check Required Secrets" | |
| uses: ./.github/actions/check-required-secret | |
| with: | |
| secret-name: "SOURCE_PUSH_TOKEN" | |
| secret-value: "${{secrets.SOURCE_PUSH_TOKEN}}" | |
| - 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 | |
| untrusted-output: "true" | |
| # @@required: main | |
| 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| clean: true | |
| fetch-depth: 0 | |
| - name: "Check Required Secrets" | |
| uses: ./.github/actions/check-required-secret | |
| with: | |
| secret-name: "SOURCE_PUSH_TOKEN" | |
| secret-value: "${{secrets.SOURCE_PUSH_TOKEN}}" | |
| - name: "Run Linter" | |
| uses: ./.github/actions/super-linter | |
| with: | |
| mode: "pr" | |
| github-token: "${{secrets.SOURCE_PUSH_TOKEN}}" | |
| # @@required: main | |
| poutine: | |
| runs-on: "ubuntu-latest" | |
| permissions: | |
| security-events: write | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: "Initialise Workspace" | |
| if: runner.environment == 'self-hosted' | |
| shell: bash | |
| run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
| - name: "Checkout Source" | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: "Check repo visibility" | |
| id: visibility | |
| uses: ./.github/actions/check-repo-visibility | |
| - name: "Ensure Results folder exists" | |
| working-directory: "${{github.workspace}}" | |
| shell: bash | |
| run: | | |
| mkdir -p "$GITHUB_WORKSPACE/results" | |
| echo "✅ Results folder ready: $GITHUB_WORKSPACE/results" | |
| - name: "Poutine" | |
| uses: boostsecurityio/poutine-action@e240ebd3eff8b2db5a8e5f6b28f58739d7db2247 # v1.1.4 | |
| with: | |
| format: "sarif" | |
| output: "${{github.workspace}}/results/poutine.sarif" | |
| - name: "Summarise Poutine findings" | |
| uses: ./.github/actions/sarif-summary | |
| with: | |
| title: "Poutine findings" | |
| glob: "poutine.sarif" | |
| ############################################################################################################ | |
| # Upload Sarif files to GitHub | |
| ############################################################################################################ | |
| - name: "Upload SARIF file for diagnostics" | |
| if: always() | |
| uses: ./.github/actions/sarif | |
| with: | |
| repo-visibility: "${{steps.visibility.outputs.is-public == 'true' && 'public' || 'private'}}" | |
| repo-fork: "${{steps.visibility.outputs.is-fork}}" |