Skip to content

Update workflows

Update workflows #20

name: Update workflows
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/*code-quality-check.yml"
permissions:
contents: write
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
jobs:
update-workflows:
name: Update external code quality workflow
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ssh-key: ${{ secrets.PREPARE_FLAVORS_SSH_KEY }}
- name: Update core workflow
run: |
cp .github/workflows/code-quality-check.yml .
- name: Update flavours code quality checks
run: |
mkdir -p flavors
for flavor in c_cpp ci_light cupcake documentation dotnet dotnetweb formatters go java javascript php python ruby rust salesforce security swift terraform
do
echo "::group::${flavor}"
sed -e "s|oxsecurity/megalinter|oxsecurity/megalinter/flavors/${flavor}|" .github/workflows/code-quality-check.yml > .github/workflows/${flavor}-code-quality-check.yml
sed -i -e "s|name: Code Quality|name: Code Quality ${flavor}|" .github/workflows/${flavor}-code-quality-check.yml
echo "Updated .github/workflows/${flavor}-code-quality-check.yml"
echo "::endgroup::"
done
- name: Check for changes
id: check_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> "$GITHUB_OUTPUT";
fi
- name: Commit updated workflows
if: steps.check_changes.outputs.changes
run: |
git config user.name "github-actions[bot]"
git config user.email "${{ github.workflow }}+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "fix(common): Autogenerated workflows update"
git push