diff --git a/.github/workflows/repo-banner.yml b/.github/workflows/repo-banner.yml index 6643548b..4870ff1f 100644 --- a/.github/workflows/repo-banner.yml +++ b/.github/workflows/repo-banner.yml @@ -25,30 +25,39 @@ jobs: - name: Determine Repo Type id: repo run: | - if [[ "${{ steps.metadata.outputs.repository_name }}" == "terraform-*-provider" ]]; then + name="${{ steps.metadata.outputs.repository_name }}" + type="Project" + desc="${{ steps.metadata.outputs.repository_description }}" + + if [[ "${name}" == "terraform-*-provider" ]]; then echo "Setting repo type to Terraform Provider" echo "type=Terraform Provider" >> $GITHUB_OUTPUT - echo "name=${${{ steps.metadata.outputs.repository_name }}#terraform-}" >> $GITHUB_OUTPUT - elif [[ "${{ steps.metadata.outputs.repository_name }}" == "terraform-aws*" ]]; then + echo "name=${name#terraform-}" >> $GITHUB_OUTPUT + elif [[ "${name}" == "terraform-aws*" ]]; then echo "Setting repo type to Terraform Module" echo "type=Terraform Module" >> $GITHUB_OUTPUT - echo "name=${${{ steps.metadata.outputs.repository_name }}#terraform-}" >> $GITHUB_OUTPUT - elif [[ "${{ steps.metadata.outputs.repository_name }}" == "github-action-*" ]]; then + echo "name=${name#terraform-}" >> $GITHUB_OUTPUT + elif [[ "${name}" == "github-action-*" ]]; then echo "Setting repo type to GitHub Action" echo "type=GitHub Action" >> $GITHUB_OUTPUT - echo "name=${${{ steps.metadata.outputs.repository_name }}#github-action-}" >> $GITHUB_OUTPUT - elif [[ "${{ steps.metadata.outputs.repository_name }}" == "example-*" ]]; then + echo "name=${name#github-action-}" >> $GITHUB_OUTPUT + elif [[ "${name}" == "example-*" ]]; then echo "Setting repo type to Example" echo "type=Example" >> $GITHUB_OUTPUT - echo "name=${${{ steps.metadata.outputs.repository_name }}#example-}" >> $GITHUB_OUTPUT - elif [[ "${{ steps.metadata.outputs.repository_name }}" == "infra-*" ]]; then + echo "name=${name#example-}" >> $GITHUB_OUTPUT + elif [[ "${name}" == "infra-*" ]]; then echo "Setting repo type to Infrastructure" echo "type=Infrastructure" >> $GITHUB_OUTPUT - echo "name=${${{ steps.metadata.outputs.repository_name }}#infra-}" >> $GITHUB_OUTPUT + echo "name=${name#infra-}" >> $GITHUB_OUTPUT else echo "Repo type is undetermined" - echo "type=Project" >> $GITHUB_OUTPUT - echo "name=${{ steps.metadata.outputs.repository_name }}" >> $GITHUB_OUTPUT + fi + + if [[ "${desc}" == "null" ]]; then + echo "desc=" >> $GITHUB_OUTPUT + else + # Only keep the first sentence + echo "desc=${desc/.*}" >> $GITHUB_OUTPUT fi - name: Generate banner image @@ -58,8 +67,8 @@ jobs: url: "file://${{github.workspace}}/banner/index.html" output: "banner/image.png" customizations: | - "#name": "${{ steps.repo.outputs.repository_name }}" - "#type": "${{ steps.repo.outputs.repository_name }}" + "#name": "${{ steps.repo.outputs.name }}" + "#type": "${{ steps.repo.outputs.type }}" "#desc": "${{ steps.metadata.outputs.repository_description }}" viewportWidth: 1280 viewportHeight: 320