pull-request.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.5
  11. - name: Setup Node
  12. uses: actions/setup-node@v4
  13. with:
  14. node-version: 20
  15. - name: Install node modules
  16. run: npm install
  17. - name: Setup Hugo
  18. uses: peaceiris/actions-hugo@v3.0.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.5
  31. - name: Setup Node
  32. uses: actions/setup-node@v4
  33. with:
  34. node-version: 20
  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@v12.0.1
  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.5
  76. # run markdown linter
  77. - uses: gaurav-nelson/github-action-markdown-link-check@1.0.15