command-pull-3rdparty.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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@v2
  17. with:
  18. token: ${{ secrets.COMMAND_BOT_PAT }}
  19. repository: ${{ github.event.repository.full_name }}
  20. comment-id: ${{ github.event.comment.id }}
  21. reaction-type: "+1"
  22. - name: Checkout the latest code
  23. uses: actions/checkout@v3
  24. with:
  25. fetch-depth: 0
  26. token: ${{ secrets.COMMAND_BOT_PAT }}
  27. - name: Setup git
  28. run: |
  29. git config --local user.email "nextcloud-command@users.noreply.github.com"
  30. git config --local user.name "nextcloud-command"
  31. - name: Pull 3rdparty
  32. run: git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin ${{ github.event.issue.pull_request.base.ref }}; fi'
  33. - name: Commit and push changes
  34. run: |
  35. git add 3rdparty
  36. git commit -s -m "Update submodule 3rdparty to latest ${{ github.event.issue.pull_request.base.ref }}"
  37. git push
  38. - name: Add reaction on failure
  39. uses: peter-evans/create-or-update-comment@v2
  40. if: failure()
  41. with:
  42. token: ${{ secrets.COMMAND_BOT_PAT }}
  43. repository: ${{ github.event.repository.full_name }}
  44. comment-id: ${{ github.event.comment.id }}
  45. reaction-type: "-1"