1
0

command-pull-3rdparty.yml 2.2 KB

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