2929 required : false
3030 default : ' '
3131 type : string
32+ github_app_id :
33+ description : ' GitHub App ID that will be used to create the PR'
34+ required : false
35+ default : ' '
36+ type : string
3237 secrets :
3338 github_pat :
3439 description : ' PAT or GitHub App token that will be used to create the PR'
35- required : true
40+ required : false
41+ github_app_key :
42+ description : ' GitHub App private key that will be used to create the PR'
43+ required : false
3644env :
3745 BUNDLE_WITHOUT : development:test:system_tests
3846 BUNDLE_WITH : release
4957 runs-on : ubuntu-24.04
5058 if : github.repository_owner == inputs.allowed_owner
5159 steps :
60+ - name : Validate input
61+ run : |
62+ if [[ -z "${{ secrets.github_pat }}" && -z "${{ secrets.github_app_key }}" ]]; then
63+ echo "Error: either PAT or GitHub App credentials are required"
64+ exit 1
65+ fi
66+ if [[ -n "${{ secrets.github_pat }}" && -n "${{ secrets.github_app_key }}" ]]; then
67+ echo "Error: use either PAT or GitHub App credentials"
68+ exit 1
69+ fi
70+ if [[ -n "${{ inputs.github_app_id }}" && -z "${{ secrets.github_app_key }}" ]]; then
71+ echo "Error: github_app_key secret is required when using github_app_id"
72+ exit 1
73+ fi
74+ - name : Generate GitHub App Token
75+ if : inputs.github_app_id != ''
76+ id : generate-token
77+ uses : actions/create-github-app-token@v2
78+ with :
79+ app-id : ${{ inputs.github_app_id }}
80+ private-key : ${{ secrets.github_app_key }}
5281 - name : Checkout repository
5382 uses : actions/checkout@v4
5483 with :
@@ -69,11 +98,19 @@ jobs:
6998 bundle exec rake module:bump
7099 fi
71100 - name : Prepare the release
101+ if : inputs.github_app_id == ''
72102 env :
73103 # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication
74104 CHANGELOG_GITHUB_TOKEN : ' ${{ secrets.github_pat }}'
75105 run : bundle exec rake release:prepare
106+ - name : Prepare the release
107+ if : inputs.github_app_id != ''
108+ env :
109+ # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication
110+ CHANGELOG_GITHUB_TOKEN : ' ${{ steps.generate-token.outputs.token }}'
111+ run : bundle exec rake release:prepare
76112 - name : Create pull Request
113+ if : inputs.github_app_id == ''
77114 uses : peter-evans/create-pull-request@v7
78115 with :
79116 commit-message : " Release ${{ inputs.version }}"
@@ -87,3 +124,18 @@ jobs:
87124 body : |
88125 Automated release-prep through https://github.com/voxpupuli/gha-puppet/ from commit ${{ github.sha }}.
89126 Checkout the [module release instructions](https://voxpupuli.org/docs/releasing_version/).
127+ - name : Create pull Request
128+ if : inputs.github_app_id != ''
129+ uses : peter-evans/create-pull-request@v7
130+ with :
131+ commit-message : " Release ${{ inputs.version }}"
132+ branch : release-prep
133+ delete-branch : true
134+ sign-commits : ${{ inputs.sign-commits }}
135+ title : " Release ${{ inputs.version }}"
136+ labels : skip-changelog
137+ token : ' ${{ steps.generate-token.outputs.token }}'
138+ assignees : ' ${{ github.triggering_actor }}'
139+ body : |
140+ Automated release-prep through https://github.com/voxpupuli/gha-puppet/ from commit ${{ github.sha }}.
141+ Checkout the [module release instructions](https://voxpupuli.org/docs/releasing_version/).
0 commit comments