|
|
|
|
@ -38,24 +38,56 @@ jobs:
|
|
|
|
|
id: comment-branch
|
|
|
|
|
|
|
|
|
|
- name: Checkout ${{ steps.comment-branch.outputs.head_ref }}
|
|
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
|
with:
|
|
|
|
|
persist-credentials: false
|
|
|
|
|
fetch-depth: 0
|
|
|
|
|
token: ${{ secrets.COMMAND_BOT_PAT }}
|
|
|
|
|
ref: ${{ steps.comment-branch.outputs.head_ref }}
|
|
|
|
|
|
|
|
|
|
- name: Register server reference to fallback to master branch
|
|
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
|
|
|
with:
|
|
|
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
|
script: |
|
|
|
|
|
const baseRef = context.payload.pull_request.base.ref
|
|
|
|
|
if (baseRef === 'main' || baseRef === 'master') {
|
|
|
|
|
core.exportVariable('server_ref', 'master');
|
|
|
|
|
console.log('Setting server_ref to master');
|
|
|
|
|
} else {
|
|
|
|
|
const regex = /^stable(\d+)$/
|
|
|
|
|
const match = baseRef.match(regex)
|
|
|
|
|
if (match) {
|
|
|
|
|
core.exportVariable('server_ref', match[0]);
|
|
|
|
|
console.log('Setting server_ref to ' + match[0]);
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Not based on master/main/stable*, so skipping freeze check');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- name: Setup git
|
|
|
|
|
run: |
|
|
|
|
|
git config --local user.email 'nextcloud-command@users.noreply.github.com'
|
|
|
|
|
git config --local user.name 'nextcloud-command'
|
|
|
|
|
|
|
|
|
|
- name: Add reaction on failure
|
|
|
|
|
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v3.0.1
|
|
|
|
|
if: ${{ env.server_ref == '' }}
|
|
|
|
|
with:
|
|
|
|
|
token: ${{ secrets.COMMAND_BOT_PAT }}
|
|
|
|
|
repository: ${{ github.event.repository.full_name }}
|
|
|
|
|
comment-id: ${{ github.event.comment.id }}
|
|
|
|
|
reactions: '-1'
|
|
|
|
|
|
|
|
|
|
- name: Pull 3rdparty
|
|
|
|
|
run: git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin '"'"'${{ github.event.issue.pull_request.base.ref }}'"'"'; fi'
|
|
|
|
|
if: ${{ env.server_ref != '' }}
|
|
|
|
|
run: git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin '"'"'${{ env.server_ref }}'"'"'; fi'
|
|
|
|
|
|
|
|
|
|
- name: Commit and push changes
|
|
|
|
|
if: ${{ env.server_ref != '' }}
|
|
|
|
|
run: |
|
|
|
|
|
git add 3rdparty
|
|
|
|
|
git commit -s -m 'Update submodule 3rdparty to latest ${{ github.event.issue.pull_request.base.ref }}'
|
|
|
|
|
git commit -s -m 'Update submodule 3rdparty to latest ${{ env.server_ref }}'
|
|
|
|
|
git push
|
|
|
|
|
|
|
|
|
|
- name: Add reaction on failure
|
|
|
|
|
|