[DEVOPS-618] Re-design Helm implementation for scalability #308
Workflow file for this run
This file contains 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
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: Install jq apt package | |
run: sudo apt-get update -y && sudo apt-get install jq -y | |
- name: Get Prettier version | |
id: prettier-version | |
run: | | |
VERSION=$(yarn list --pattern prettier | grep "prettier" | awk -F '@' '{print $2}') | |
if [[ -z "$VERSION" ]]; then | |
echo "prettier-version=latest" >> $GITHUB_ENV | |
else | |
echo "prettier-version=$VERSION" >> $GITHUB_ENV | |
fi | |
echo "Prettier version: $VERSION" | |
- 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 | |
echo "Prettier plugins: $PRETTIER_PLUGINS" | |
- 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: Andrews-McMeel-Universal/prettier_action@v4 | |
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 }} | |
prettier_version: ${{ env.prettier-version }} | |
working_directory: ${{ github.workspace }} | |
- name: Run prettier with .prettierrc.json configuration | |
if: ${{ steps.prettier-config-json.outputs.files_exists == 'true' }} | |
uses: Andrews-McMeel-Universal/prettier_action@v4 | |
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 }} | |
prettier_version: ${{ env.prettier-version }} | |
working_directory: ${{ github.workspace }} | |
- 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: Andrews-McMeel-Universal/prettier_action@v4 | |
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 }} | |
prettier_version: ${{ env.prettier-version }} | |
working_directory: ${{ github.workspace }} | |
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 |