File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -163,5 +163,23 @@ jobs:
163
163
ANSIBLE_CONFIG : ansible/ansible.cfg
164
164
run : |
165
165
ansible-playbook -i ansible/hosts.ini ./ansible/playbooks/deploy-docker.yml \
166
- --extra-vars "target_host=${{ env.target_host }} folder=${{ env.folder }} bw_access_token=${{ secrets.BW_ACCESS_TOKEN }}"
166
+ --extra-vars "target_host=${{ env.target_host }} folder=${{ env.folder }} bw_access_token=${{ secrets.BW_ACCESS_TOKEN }}" | tee ansible_output.txt
167
+
168
+ - name : Post Ansible Output as PR Comment
169
+ if : github.event.pull_request.merged == true
170
+ uses : https://github.com/actions/github-script@v7
171
+ with :
172
+ github-token : ${{ secrets.GITHUB_TOKEN }}
173
+ script : |
174
+ const fs = require('fs');
175
+ const output = fs.readFileSync('ansible_output.txt', 'utf8');
176
+ const prNumber = context.payload.pull_request.number;
177
+
178
+ await github.rest.issues.createComment({
179
+ owner: context.repo.owner,
180
+ repo: context.repo.repo,
181
+ issue_number: prNumber,
182
+ body: `### Ansible Deployment Output\n\`\`\`\n${output}\n\`\`\``
183
+ });
184
+
167
185
You can’t perform that action at this time.
0 commit comments