Skip to content

[DEVOPS-578] Fix "API already exists" errors #268

[DEVOPS-578] Fix "API already exists" errors

[DEVOPS-578] Fix "API already exists" errors #268

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
onlyChanged:
default: ${{ vars.SIMPLE_LINT_ONLY_CHANGED || 'true' }}
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 }}
fetch-depth: 0
- 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: ${{ inputs.onlyChanged }}
- 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: ${{ inputs.onlyChanged }}
- 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: ${{ inputs.onlyChanged }}
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