action.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Compare storage layouts
  2. inputs:
  3. token:
  4. description: github token
  5. required: true
  6. buildinfo:
  7. description: compilation artifacts
  8. required: false
  9. default: artifacts/build-info/*.json
  10. layout:
  11. description: extracted storage layout
  12. required: false
  13. default: HEAD.layout.json
  14. out_layout:
  15. description: storage layout to upload
  16. required: false
  17. default: ${{ github.ref_name }}.layout.json
  18. ref_layout:
  19. description: storage layout for the reference branch
  20. required: false
  21. default: ${{ github.base_ref }}.layout.json
  22. runs:
  23. using: composite
  24. steps:
  25. - name: Extract layout
  26. run: |
  27. node scripts/checks/extract-layout.js ${{ inputs.buildinfo }} > ${{ inputs.layout }}
  28. shell: bash
  29. - name: Download reference
  30. if: github.event_name == 'pull_request'
  31. run: |
  32. RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'`
  33. gh run download ${RUN_ID} --repo ${{ github.repository }} -n layout
  34. env:
  35. GITHUB_TOKEN: ${{ inputs.token }}
  36. shell: bash
  37. continue-on-error: true
  38. id: reference
  39. - name: Compare layouts
  40. if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
  41. run: |
  42. node scripts/checks/compare-layout.js --head ${{ inputs.layout }} --ref ${{ inputs.ref_layout }}
  43. shell: bash
  44. - name: Rename artifacts for upload
  45. if: github.event_name != 'pull_request'
  46. run: |
  47. mv ${{ inputs.layout }} ${{ inputs.out_layout }}
  48. shell: bash
  49. - name: Save artifacts
  50. if: github.event_name != 'pull_request'
  51. uses: actions/upload-artifact@v3
  52. with:
  53. name: layout
  54. path: ${{ inputs.out_layout }}