1111 description : ' A short description of the project.'
1212 required : true
1313 default : ' A new awesome project.'
14- project_homepage_url :
15- description : " The URL for the project's GitHub homepage."
16- required : true
17- default : ' https://github.com/username/repo'
1814 cpack_package_contact :
1915 description : ' The contact email for the project.'
2016 required : true
2117 default : ' user@example.com'
18+ project_homepage_url :
19+ description : " The URL for the project's homepage. Leave empty to use the repository URL."
20+ required : false
21+ default : ' Leave empty to use repository URL'
2222
2323jobs :
2424 configure_project :
4242 PROJECT_NAME_LOWER=$(echo "${{ github.event.inputs.new_project_name }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')
4343 echo "project_name_lower=$PROJECT_NAME_LOWER" >> $GITHUB_OUTPUT
4444
45+ - name : Set homepage URL
46+ id : set-url
47+ run : |
48+ if [ "${{ github.event.inputs.project_homepage_url }}" = "Leave empty to use repository URL" ] || [ -z "${{ github.event.inputs.project_homepage_url }}" ]; then
49+ echo "homepage_url=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_OUTPUT
50+ else
51+ echo "homepage_url=${{ github.event.inputs.project_homepage_url }}" >> $GITHUB_OUTPUT
52+ fi
53+
4554 - name : Replace project template placeholders
4655 run : |
4756 # This command finds all files and uses 'sed' to replace all the placeholders.
5059 -e "s|{{PROJECT_NAME}}|${{ github.event.inputs.new_project_name }}|g" \
5160 -e "s|{{PROJECT_NAME_LOWER}}|${{ steps.set-variables.outputs.project_name_lower }}|g" \
5261 -e "s|{{PROJECT_DESCRIPTION}}|${{ github.event.inputs.project_description }}|g" \
53- -e "s|{{PROJECT_HOMEPAGE_URL}}|${{ github.event.inputs.project_homepage_url }}|g" \
62+ -e "s|{{PROJECT_REPOSITORY_URL}}|${{ github.server_url }}/${{ github.repository }}|g" \
63+ -e "s|{{PROJECT_HOMEPAGE_URL}}|${{ steps.set-url.outputs.homepage_url }}|g" \
5464 -e "s|{{CPACK_PACKAGE_CONTACT}}|${{ github.event.inputs.cpack_package_contact }}|g" \
5565 {} +
5666
7282 body : |
7383 This pull request configures the project from the template with the information you provided.
7484 branch : configure-project-${{ github.run_number }}
75- token : ${{ secrets.GITHUB_TOKEN }}
85+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments