commands.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. name: Commands
  2. on:
  3. issue_comment:
  4. types:
  5. - created
  6. - edited
  7. pull_request_target:
  8. types:
  9. - labeled
  10. - synchronize
  11. permissions: {}
  12. jobs:
  13. rebase:
  14. name: Rebase
  15. if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '@jellyfin-bot rebase') && github.event.comment.author_association == 'MEMBER'
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Notify as seen
  19. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  20. with:
  21. token: ${{ secrets.JF_BOT_TOKEN }}
  22. comment-id: ${{ github.event.comment.id }}
  23. reactions: '+1'
  24. - name: Checkout the latest code
  25. uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
  26. with:
  27. token: ${{ secrets.JF_BOT_TOKEN }}
  28. fetch-depth: 0
  29. - name: Automatic Rebase
  30. uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 # 1.8
  31. env:
  32. GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
  33. check-backport:
  34. permissions:
  35. contents: read
  36. name: Check Backport
  37. if: ${{ ( github.event.issue.pull_request && contains(github.event.comment.body, '@jellyfin-bot check backport') ) || github.event.label.name == 'stable backport' || contains(github.event.pull_request.labels.*.name, 'stable backport' ) }}
  38. runs-on: ubuntu-latest
  39. steps:
  40. - name: Notify as seen
  41. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  42. if: ${{ github.event.comment != null }}
  43. with:
  44. token: ${{ secrets.JF_BOT_TOKEN }}
  45. comment-id: ${{ github.event.comment.id }}
  46. reactions: eyes
  47. - name: Checkout the latest code
  48. uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
  49. with:
  50. token: ${{ secrets.JF_BOT_TOKEN }}
  51. fetch-depth: 0
  52. - name: Notify as running
  53. id: comment_running
  54. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  55. if: ${{ github.event.comment != null }}
  56. with:
  57. token: ${{ secrets.JF_BOT_TOKEN }}
  58. issue-number: ${{ github.event.issue.number }}
  59. body: |
  60. Running backport tests...
  61. - name: Perform test backport
  62. id: run_tests
  63. run: |
  64. set +o errexit
  65. git config --global user.name "Jellyfin Bot"
  66. git config --global user.email "team@jellyfin.org"
  67. CURRENT_BRANCH="origin/${GITHUB_HEAD_REF}"
  68. git checkout master
  69. git merge --no-ff ${CURRENT_BRANCH}
  70. MERGE_COMMIT_HASH=$( git log -q -1 | head -1 | awk '{ print $2 }' )
  71. git fetch --all
  72. CURRENT_STABLE=$( git branch -r | grep 'origin/release' | sort -rV | head -1 | awk -F '/' '{ print $NF }' )
  73. stable_branch="Current stable release branch: ${CURRENT_STABLE}"
  74. echo ${stable_branch}
  75. echo ::set-output name=branch::${stable_branch}
  76. git checkout -t origin/${CURRENT_STABLE} -b ${CURRENT_STABLE}
  77. git cherry-pick -sx -m1 ${MERGE_COMMIT_HASH} &>output.txt
  78. retcode=$?
  79. cat output.txt | grep -v 'hint:'
  80. output="$( grep -v 'hint:' output.txt )"
  81. output="${output//'%'/'%25'}"
  82. output="${output//$'\n'/'%0A'}"
  83. output="${output//$'\r'/'%0D'}"
  84. echo ::set-output name=output::$output
  85. exit ${retcode}
  86. - name: Notify with result success
  87. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  88. if: ${{ github.event.comment != null && success() }}
  89. with:
  90. token: ${{ secrets.JF_BOT_TOKEN }}
  91. comment-id: ${{ steps.comment_running.outputs.comment-id }}
  92. body: |
  93. ${{ steps.run_tests.outputs.branch }}
  94. Output from `git cherry-pick`:
  95. ---
  96. ${{ steps.run_tests.outputs.output }}
  97. reactions: hooray
  98. - name: Notify with result failure
  99. uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
  100. if: ${{ github.event.comment != null && failure() }}
  101. with:
  102. token: ${{ secrets.JF_BOT_TOKEN }}
  103. comment-id: ${{ steps.comment_running.outputs.comment-id }}
  104. body: |
  105. ${{ steps.run_tests.outputs.branch }}
  106. Output from `git cherry-pick`:
  107. ---
  108. ${{ steps.run_tests.outputs.output }}
  109. reactions: confused
  110. rename:
  111. name: Rename
  112. if: contains(github.event.comment.body, '@jellyfin-bot rename') && github.event.comment.author_association == 'MEMBER'
  113. runs-on: ubuntu-latest
  114. steps:
  115. - name: pull in script
  116. uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
  117. with:
  118. repository: jellyfin/jellyfin-triage-script
  119. - name: install python
  120. uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
  121. with:
  122. python-version: '3.12'
  123. cache: 'pip'
  124. - name: install python packages
  125. run: pip install -r rename/requirements.txt
  126. - name: run rename script
  127. run: python3 rename.py
  128. working-directory: ./rename
  129. env:
  130. GH_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
  131. GH_REPO: ${{ github.repository }}
  132. ISSUE: ${{ github.event.issue.number }}
  133. COMMENT_ID: ${{ github.event.comment.id }}