action.yml 1.9 KB

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