|
| 1 | +name: Sync workspace |
| 2 | + |
| 3 | +inputs: |
| 4 | + base_branch: |
| 5 | + description: Base branch |
| 6 | + required: true |
| 7 | + default: qcom-next-staging |
| 8 | + pr_number: |
| 9 | + description: PR number |
| 10 | + required: false |
| 11 | + |
| 12 | +outputs: |
| 13 | + workspace_path: |
| 14 | + description: Sync workspace path |
| 15 | + value: ${{ steps.set-workspace.outputs.workspace }} |
| 16 | + |
| 17 | +runs: |
| 18 | + using: "composite" |
| 19 | + steps: |
| 20 | + - name: Checkout PR branch |
| 21 | + if: inputs.base_branch == 'qcom-next-staging' |
| 22 | + uses: actions/checkout@v4 |
| 23 | + shell: bash |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Configure git |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + git config --global user.name "github-actions" |
| 31 | + git config --global user.email "github-actions@github.com" |
| 32 | +
|
| 33 | + - name: Sync with latest changes |
| 34 | + if: inputs.base_branch == 'qcom-next-staging' |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + set -e |
| 38 | + echo "Syncing with latest changes..." |
| 39 | + git fetch origin ${{ inputs.base_branch }} |
| 40 | + git merge --no-ff origin/${{ inputs.base_branch }} |
| 41 | +
|
| 42 | + - name: Clone repositories |
| 43 | + if: inputs.base_branch != 'qcom-next-staging' |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + git clone https://github.com/qualcomm-linux/kernel.git |
| 47 | + git clone https://github.com/qualcomm-linux/automerge.git |
| 48 | +
|
| 49 | + - name: Create merge configuration |
| 50 | + if: inputs.base_branch != 'qcom-next-staging' |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + TOPIC_BRANCH=${{ inputs.base_branch }} |
| 54 | + cat <<EOF > merge.conf |
| 55 | + baseline https://github.com/qualcomm-linux/kernel.git qcom-next |
| 56 | + topic https://github.com/qualcomm-linux/kernel-topics.git $TOPIC_BRANCH |
| 57 | + EOF |
| 58 | + echo "File 'merge.conf' created successfully." |
| 59 | +
|
| 60 | + - name: Run auto merge |
| 61 | + id: automerge |
| 62 | + if: inputs.base_branch != 'qcom-next-staging' |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + cd kernel |
| 66 | + ../automerge/ci-merge -f ../merge.conf -t head -n |
| 67 | +
|
| 68 | + - name: Fetch PR |
| 69 | + if: inputs.base_branch != 'qcom-next-staging' |
| 70 | + shell: bash |
| 71 | + run: | |
| 72 | + cd kernel |
| 73 | + git fetch https://github.com/qualcomm-linux/kernel-topics.git pull/${{inputs.pr_number}}/head:pr-${{inputs.pr_number}} |
| 74 | + git merge pr-${{inputs.pr_number}} --no-commit |
| 75 | + git commit -m "Merged PR ${{inputs.pr_number}}" |
| 76 | +
|
| 77 | + - name: Set workspace path |
| 78 | + id: set-workspace |
| 79 | + shell: bash |
| 80 | + run: | |
| 81 | + if [[ "${{ inputs.base_branch }}" == "qcom-next-staging" ]]; then |
| 82 | + echo "workspace=${{ github.workspace }}" >> "$GITHUB_OUTPUT" |
| 83 | + else |
| 84 | + echo "workspace=${{ github.workspace }}/kernel" >> "$GITHUB_OUTPUT" |
0 commit comments