command-pull-3rdparty.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Update 3rdparty command
  2. on:
  3. issue_comment:
  4. types: created
  5. permissions:
  6. contents: read
  7. jobs:
  8. rebase:
  9. runs-on: ubuntu-latest
  10. permissions:
  11. contents: none
  12. # On pull requests and if the comment starts with `/update-3rdparty`
  13. if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/update-3rdparty')
  14. steps:
  15. - name: Add reaction on start
  16. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v3.0.1
  17. with:
  18. token: ${{ secrets.COMMAND_BOT_PAT }}
  19. repository: ${{ github.event.repository.full_name }}
  20. comment-id: ${{ github.event.comment.id }}
  21. reactions: "+1"
  22. - name: Init branch
  23. uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
  24. id: comment-branch
  25. - name: Checkout ${{ steps.comment-branch.outputs.head_ref }}
  26. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
  27. with:
  28. fetch-depth: 0
  29. token: ${{ secrets.COMMAND_BOT_PAT }}
  30. ref: ${{ steps.comment-branch.outputs.head_ref }}
  31. - name: Setup git
  32. run: |
  33. git config --local user.email "nextcloud-command@users.noreply.github.com"
  34. git config --local user.name "nextcloud-command"
  35. - name: Pull 3rdparty
  36. run: git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin ${{ github.event.issue.pull_request.base.ref }}; fi'
  37. - name: Commit and push changes
  38. run: |
  39. git add 3rdparty
  40. git commit -s -m "Update submodule 3rdparty to latest ${{ github.event.issue.pull_request.base.ref }}"
  41. git push
  42. - name: Add reaction on failure
  43. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v3.0.1
  44. if: failure()
  45. with:
  46. token: ${{ secrets.COMMAND_BOT_PAT }}
  47. repository: ${{ github.event.repository.full_name }}
  48. comment-id: ${{ github.event.comment.id }}
  49. reactions: "-1"