Skip to content

[DEVOPS-530] Replace Azure PowerShell actions and update logging #248

[DEVOPS-530] Replace Azure PowerShell actions and update logging

[DEVOPS-530] Replace Azure PowerShell actions and update logging #248

Workflow file for this run

name: Simple Linter and Formatter
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
inputs:
runPrettier:
default: true
type: boolean
prettierPlugins:
description: Install Prettier plugins, i.e. '@prettier/plugin-php @prettier/plugin-other'
type: string
secrets:
PAT_ACTION_CI:
required: true
jobs:
prettier:
name: Prettier Check
if: ${{ inputs.runPrettier }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_ACTION_CI }}
ref: ${{ github.head_ref }}
- name: Run yarn install
if: ${{ inputs.prettierPlugins }}
uses: Andrews-McMeel-Universal/cache-yarn-install@v1
- name: Set prettier plugin arguments
id: prettier-plugins
if: ${{ inputs.prettierPlugins }}
run: |
PLUGINS=(${{ inputs.prettierPlugins }})
for PLUGIN in "${PLUGINS[@]}"; do
PRETTIER_PLUGINS="$PRETTIER_PLUGINS --plugin $PLUGIN"
done
echo "prettierPlugins=$PRETTIER_PLUGINS" >> $GITHUB_OUTPUT
- name: Check if .prettierrc.js file exists
id: prettier-config-js
uses: andstor/file-existence-action@v3
with:
files: ".prettierrc.js"
- name: Check if .prettierrc.json file exists
id: prettier-config-json
uses: andstor/file-existence-action@v3
with:
files: ".prettierrc.json"
- name: Run prettier with .prettierrc.js configuration
if: ${{ steps.prettier-config-js.outputs.files_exists == 'true' }}
uses: creyD/prettier_action@v4.3
with:
prettier_options: --write . --ignore-path ./.prettierignore --config ./.prettierrc.js ${{ steps.prettier-plugins.outputs.prettierPlugins }}
prettier_plugins: ${{ inputs.prettierPlugins }}
commit_message: "[Simple Linter] Apply prettier changes"
only_changed: true
- name: Run prettier with .prettierrc.json configuration
if: ${{ steps.prettier-config-json.outputs.files_exists == 'true' }}
uses: creyD/prettier_action@v4.3
with:
prettier_options: --write . --ignore-path ./.prettierignore --config ./.prettierrc.json ${{ steps.prettier-plugins.outputs.prettierPlugins }}
prettier_plugins: ${{ inputs.prettierPlugins }}
commit_message: "[Simple Linter] Apply prettier changes"
only_changed: true
- name: Run prettier without any configuration files
if: ${{ steps.prettier-config-js.outputs.files_exists != 'true' && steps.prettier-config-json.outputs.files_exists != 'true' }}
uses: creyD/prettier_action@v4.3
with:
prettier_options: --write . --ignore-path ./.prettierignore ${{ steps.prettier-plugins.outputs.prettierPlugins }}
prettier_plugins: ${{ inputs.prettierPlugins }}
commit_message: "[Simple Linter] Apply prettier changes"
only_changed: true
lint-workflows:
name: Workflow linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Lint workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color -ignore "SC2086" -ignore "SC2129"
shell: bash