pull-request.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. name: PR Workflows
  2. # Run action on pull request event
  3. on: [pull_request]
  4. jobs:
  5. # Build exampleSite
  6. build:
  7. runs-on: ubuntu-latest
  8. steps:
  9. # checkout to the commit that has been pushed
  10. - uses: actions/checkout@v4.1.1
  11. - name: Setup Node
  12. uses: actions/setup-node@v4
  13. with:
  14. node-version: 18
  15. - name: Install node modules
  16. run: npm install
  17. - name: Setup Hugo
  18. uses: peaceiris/actions-hugo@v2.6.0
  19. with:
  20. hugo-version: 'latest'
  21. extended: true
  22. - name: Build
  23. run: |
  24. cd exampleSite
  25. hugo --minify
  26. # Run linter
  27. lint:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - uses: actions/checkout@v4.1.1
  31. - name: Setup Node
  32. uses: actions/setup-node@v4
  33. with:
  34. node-version: 18
  35. - name: Install node modules
  36. run: npm install
  37. - name: Lint
  38. run: |
  39. npm run lint
  40. lighthouse-check:
  41. runs-on: ubuntu-latest
  42. steps:
  43. - name: Waiting for Netlify Preview
  44. uses: kamranayub/wait-for-netlify-action@v2.1.1
  45. id: preview
  46. with:
  47. site_name: "toha-ci"
  48. max_timeout: 300
  49. env:
  50. NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}}
  51. - name: Run Lighthouse
  52. uses: foo-software/lighthouse-check-action@v10.0.0
  53. id: lighthouseCheck
  54. with:
  55. accessToken: ${{ secrets.LIGHTHOUSE_TOKEN }}
  56. gitHubAccessToken: ${{secrets.GITHUB_TOKEN}}
  57. emulatedFormFactor: 'all'
  58. prCommentEnabled: true
  59. prCommentSaveOld: false
  60. timeout: 5
  61. urls: "${{ steps.preview.outputs.url }},${{ steps.preview.outputs.url }}/posts/,${{ steps.preview.outputs.url }}/posts/markdown-sample/,${{ steps.preview.outputs.url }}/posts/shortcodes/"
  62. # Ensure that PR has desired labels
  63. enforce-label:
  64. runs-on: ubuntu-latest
  65. steps:
  66. - uses: yogevbd/enforce-label-action@2.2.2
  67. with:
  68. REQUIRED_LABELS_ANY: "automerge,breaking-change,bug-fix,enhancement,feature,translation"
  69. REQUIRED_LABELS_ANY_DESCRIPTION: "The PR must have at least one these labels: ['automerge','breaking-change','bug-fix','enhancement','feature','translation']"
  70. # Check for any broken links
  71. markdown-link-check:
  72. runs-on: ubuntu-latest
  73. steps:
  74. # checkout to latest commit
  75. - uses: actions/checkout@v4.1.1
  76. # run markdown linter
  77. - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15
  78. proof-html:
  79. runs-on: ubuntu-latest
  80. steps:
  81. # checkout to the commit that has been pushed
  82. - uses: actions/checkout@v4.1.1
  83. - name: Setup Node
  84. uses: actions/setup-node@v4
  85. with:
  86. node-version: 18
  87. - name: Install node modules
  88. run: npm install
  89. - name: Setup Hugo
  90. uses: peaceiris/actions-hugo@v2.6.0
  91. with:
  92. hugo-version: 'latest'
  93. extended: true
  94. - name: Build
  95. run: |
  96. cd exampleSite
  97. hugo --minify
  98. # Run HTML Proofer
  99. - uses: anishathalye/proof-html@v2.1.2
  100. with:
  101. directory: exampleSite/public
  102. enforce_https: false
  103. ignore_url: "#"