diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml deleted file mode 100644 index cdf3896b..00000000 --- a/.github/workflows/format-code.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: code-formatter - -on: - pull_request: - types: [opened, edited, reopened, synchronize] - -jobs: - format-code: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: ministryofjustice/github-actions/code-formatter@v14 - with: - ignore-files: "bad.yml,bad.yaml,secret-bad.yml" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/python-malformed-yaml.yml b/.github/workflows/python-malformed-yaml.yml index 33ef090b..e10b48e3 100644 --- a/.github/workflows/python-malformed-yaml.yml +++ b/.github/workflows/python-malformed-yaml.yml @@ -9,7 +9,7 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4.1.2 - - name: Detect malformed yaml files + - name: Detect malformed YAML files uses: ministryofjustice/github-actions/python-malformed-yaml@mal-yaml-to-python env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/python-malformed-yaml/main.py b/python-malformed-yaml/main.py index d2bf805a..dcb9936d 100644 --- a/python-malformed-yaml/main.py +++ b/python-malformed-yaml/main.py @@ -54,7 +54,10 @@ def get_malformed_yaml_files_and_errors(yaml_files: list[str]) -> list[str]: malformed_yaml_files_and_errors.append(f"\n{str(y)}:\n{str(exc)}") return malformed_yaml_files_and_errors -def message(files_and_errors: list): +def malformed_yaml_files_message(files_and_errors: list): + """ + Compose message to display in the PR. + """ msg = "😱 The following malformed YAML files and related errors were found:\n" msg += "\n".join(files_and_errors) return msg @@ -70,11 +73,11 @@ def main(): changed_yaml_files = get_changed_yaml_files_from_pr() malformed_yaml_files = get_malformed_yaml_files_and_errors(changed_yaml_files) if malformed_yaml_files: - msg = message(malformed_yaml_files) + msg = malformed_yaml_files_message(malformed_yaml_files) github.fail_pr(message=msg) print(msg) return True - else: + else: print("PR YAML files all OK!") return False