@@ -8,8 +8,9 @@ permissions:
88 pull-requests : write
99 contents : read
1010 actions : read
11+ checks : write
1112jobs :
12- build-content :
13+ compare_ds_job :
1314 name : Generate Diff
1415 runs-on : ubuntu-latest
1516 container :
@@ -30,19 +31,32 @@ jobs:
3031 id : pr_info
3132 run : |
3233 PR_NUMBER=$(cat pr-info/pr-number.txt)
34+ PR_SHA=$(cat pr-info/pr-sha.txt)
3335 BASE_BRANCH=$(cat pr-info/base-branch.txt)
3436 FORK_POINT=$(cat pr-info/fork-point.txt)
3537 echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
38+ echo "pr_sha=${PR_SHA}" >> $GITHUB_OUTPUT
3639 echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT
3740 echo "fork_point=${FORK_POINT}" >> $GITHUB_OUTPUT
3841 echo "PR Number: ${PR_NUMBER}"
42+ echo "PR SHA: ${PR_SHA}"
3943 echo "Base Branch: ${BASE_BRANCH}"
4044 echo "Fork Point: ${FORK_POINT}"
41- - name : Checkout master
45+ - name : Create GitHub check run
46+ uses : LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2.0.0
47+ id : create_check
48+ with :
49+ token : ${{ secrets.GITHUB_TOKEN }}
50+ name : Compare DS
51+ status : in_progress
52+ sha : ${{ steps.pr_info.outputs.pr_sha }}
53+ output : |
54+ {"summary":"Compare DS started. Job: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}."}
55+ - name : Checkout forking point (${{ steps.pr_info.outputs.fork_point }})
4256 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
4357 with :
4458 repo : ComplianceAsCode/content
45- ref : master
59+ ref : ${{ steps.pr_info.outputs.fork_point }}
4660 fetch-depth : 0
4761 # https://github.com/actions/checkout/issues/766
4862 - name : Set git safe directory
7589 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
7690 with :
7791 github-token : ${{ secrets.GITHUB_TOKEN }}
78- name : pr-artifacts-${{ github.event.workflow_run.head_sha }}
92+ name : pr-artifacts
7993 path : pr_artifacts
8094 run-id : ${{ github.event.workflow_run.id }}
8195 - name : Unpack built artifacts
@@ -158,7 +172,7 @@ jobs:
158172 token : ${{ secrets.GITHUB_TOKEN }}
159173 - name : Compare Ansible playbook shell commands
160174 if : ${{ steps.ctf.outputs.CTF_OUTPUT_SIZE != '0' }}
161- run : utils/ansible_shell_diff.py ssg-${{steps.product.outputs.prop}}-ds.xml build /ssg-${{steps.product.outputs.prop}}-ds.xml | tee diff.log
175+ run : utils/ansible_shell_diff.py build/ ssg-${{steps.product.outputs.prop}}-ds.xml pr_artifacts/artifacts /ssg-${{steps.product.outputs.prop}}-ds.xml | tee diff.log
162176 env :
163177 PYTHONPATH : ${{ github.workspace }}
164178 - name : Test if there are Ansible shell module changes
@@ -188,3 +202,13 @@ jobs:
188202 type : delete
189203 comment_id : ${{ steps.shell_diff.outputs.comment-id }}
190204 token : ${{ secrets.GITHUB_TOKEN }}
205+ - name : Compare DS
206+ if : always()
207+ uses : LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2.0.0
208+ with :
209+ token : ${{ secrets.GITHUB_TOKEN }}
210+ conclusion : ${{ job.status }}
211+ check_id : ${{ steps.create_check.outputs.check_id }}
212+ sha : ${{ steps.pr_info.outputs.pr_sha }}
213+ output : |
214+ {"summary":"Compare DS completed. Job: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}."}
0 commit comments