mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 20:51:21 -03:30
* Update the workflow to allow the action to write our branches from it. * Also added username and email as git by default will want to know who is performing the action (edge case). Using github actions bot is standard practice
53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
name: Rebase release_4.6 into release_4.6-next
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- release_4.6
|
|
workflow_dispatch:
|
|
# Allows manual triggering of the workflow from the GitHub UI
|
|
|
|
jobs:
|
|
rebase:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout release_4.6-next Branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: release_4.6-next
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Fetch release_4.6 Branch
|
|
run: git fetch origin release_4.6:release_4.6
|
|
|
|
- name: Attempt Rebase
|
|
id: rebase_attempt # Give this step an something to reference its outcome
|
|
run: |
|
|
git config user.name "GitHub Actions"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git checkout release_4.6-next
|
|
# Attempt the rebase.
|
|
# The '|| true' allows the script to continue even if rebase fails,
|
|
# so we can check the status and then abort.
|
|
git rebase release_4.6 || true
|
|
continue-on-error: true # Allow this step to fail without stopping the workflow immediately
|
|
|
|
- name: Check for Conflicts and Abort if Necessary
|
|
run: |
|
|
# Check if there are any unmerged paths (i.e., conflicts)
|
|
if git status --porcelain | grep "^UU"; then
|
|
echo "::error::Rebase failed due to merge conflicts. Aborting rebase."
|
|
git rebase --abort
|
|
exit 1 # Fail the job explicitly
|
|
else
|
|
echo "Rebase completed without conflicts."
|
|
fi
|
|
|
|
- name: Force Push Rebased release_4.6-next Branch
|
|
# Only run this step if the previous steps succeeded (no conflicts)
|
|
if: success() && steps.rebase_attempt.outcome != 'failure'
|
|
run: |
|
|
git push --force origin release_4.6-next
|