Skip to content

Added updateTestConfig job #43

Added updateTestConfig job

Added updateTestConfig job #43

name: Check Workspace Backstage Compatibility
on:
workflow_dispatch:
inputs:
workspace-path:
description: Relative path of a single workspace on which the export workflow should be applied.
required: false
type: string
overlay-branch:
description: Branch of the overlay structure
type: string
required: true
fail-for-required-only:
description: Fail only when some required workspaces are incompatible.
type: boolean
required: false
default: false
debug:
description: Debug the shell scripts
type: boolean
required: false
default: false
push:
branches:
- 'main'
concurrency:
group: ${{ github.workflow_ref }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-required-plugins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Create the required-plugins file@
continue-on-error: true
run: |
cat downstream-plugins > required-plugins
- name: Upload required-plugins file
uses: actions/upload-artifact@v4
with:
name: required-plugins
path: required-plugins
check:
needs:
- prepare-required-plugins
uses: redhat-developer/rhdh-plugin-export-utils/.github/workflows/check-backstage-compatibility.yaml@main
with:
overlay-branch: ${{ inputs.overlay-branch }}
workspace-path: ${{ inputs.workspace-path }}
debug: ${{ inputs.debug || false }}
fail-for-required-only: ${{ inputs.fail-for-required-only || false }}
update-badge:
needs:
- check
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout metadata branch
uses: actions/checkout@v4
with:
ref: metadata
- name: Update badge Json on the metadata branch.
env:
INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-required-workspaces }}
INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-unrequired-workspaces }}
run: |
if [[ "${{ inputs.debug }}" == "true" ]]
then
set -x
fi
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
set +e
required=$(echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | grep -c .)
optional=$(echo "${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}" | grep -c .)
set -e
cat <<EOF > incompatible-workspaces.json
{
"schemaVersion": 1,
"label": "Target Backstage Compatibility",
"message": "$((${optional}+${required})) incompatible workspaces, ${required} of which are mandatory",
"color": "$(if [[ ${required} -gt 0 ]]; then echo red; elif [ ${optional} -gt 0 ]; then echo orange; else echo green; fi)"
}
EOF
if ! git diff --quiet incompatible-workspaces.json
then
echo "Commiting changes in file: incompatible-workspaces.json"
git add incompatible-workspaces.json
git commit -m "Update badge metadata about incompatible workspaces"
git push -f origin metadata
else
echo "No change detected in file: incompatible-workspaces.json"
fi
permissions:
contents: write