validations.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Validations
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. issue_comment:
  8. types: [ created ]
  9. env:
  10. LC_CTYPE: en_US.UTF-8
  11. LANG: en_US.UTF-8
  12. jobs:
  13. validate-cocoapods:
  14. runs-on: macos-11
  15. if: github.event_name != 'issue_comment'
  16. steps:
  17. - uses: maxim-lobanov/setup-xcode@v1.4.0
  18. with:
  19. xcode-version: ^13.0
  20. - uses: actions/checkout@v2
  21. - run: pod lib lint
  22. run-danger-for-internal-pr:
  23. runs-on: ubuntu-latest
  24. if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
  25. steps:
  26. - uses: actions/checkout@v2
  27. with:
  28. fetch-depth: 0
  29. - name: danger/swift
  30. uses: docker://ghcr.io/danger/danger-swift-with-swiftlint:3.12.3
  31. env:
  32. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  33. run-danger-for-external-pr:
  34. runs-on: ubuntu-latest
  35. if: |
  36. github.event_name == 'issue_comment' && github.event.action == 'created'
  37. && github.event.issue.pull_request != null
  38. && startsWith(github.event.comment.body, '/run_checks')
  39. steps:
  40. - uses: sushichop/action-repository-permission@v1
  41. with:
  42. required-permission: write
  43. reaction-permitted: '+1'
  44. comment-not-permitted: "Sorry, you don't have the permission to execute /run_checks..."
  45. - uses: actions/github-script@v5
  46. id: pr-details
  47. with:
  48. script: |
  49. const { data: pullRequest } = await github.rest.pulls.get({
  50. owner: context.repo.owner,
  51. repo: context.repo.repo,
  52. pull_number: context.issue.number
  53. });
  54. return pullRequest;
  55. - uses: actions/checkout@v2
  56. with:
  57. repository: ${{fromJSON(steps.pr-details.outputs.result).head.repo.full_name}}
  58. ref: ${{fromJSON(steps.pr-details.outputs.result).head.ref}}
  59. fetch-depth: 0
  60. - name: danger/swift
  61. uses: docker://ghcr.io/danger/danger-swift-with-swiftlint:3.12.3
  62. with:
  63. args: "--pr ${{github.event.issue.pull_request.url}}"
  64. env:
  65. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}