11# .github/workflows/rebase-express-payments.yml
22
3- name : ' Auto Rebase adyenExpressPaymentsDreamForceTestAlertBranch '
3+ name : ' Auto Rebase adyenExpressPayments '
44
5- # This action will trigger on every push to the develop branch.
5+ # This action will trigger on the creation of new preview release tags
66on :
77 push :
8- branches :
9- - develop
8+ tags :
9+ - ' *-preview '
1010 workflow_dispatch :
1111
12+ permissions :
13+ contents : write
14+
1215jobs :
1316 rebase :
14- name : Rebase adyenExpressPaymentsDreamForceTestAlertBranch on develop
17+ name : Rebase adyenExpressPayments on preview release
1518 runs-on : ubuntu-latest
1619
1720 steps :
3437 git config --global user.name 'GitHub Actions'
3538 git config --global user.email 'actions@github.com'
3639
37- # Step 4: Switch to the adyenExpressPaymentsDreamForceTestAlertBranch branch.
38- - name : Switch to adyenExpressPaymentsDreamForceTestAlertBranch branch
39- run : git checkout adyenExpressPaymentsDreamForceTestAlertBranch
40+ # Step 4: Switch to the adyenExpressPayments branch.
41+ - name : Switch to adyenExpressPayments branch
42+ run : git checkout adyenExpressPayments
4043
4144 # Step 5: Delete all package-lock.json files before the rebase.
4245 - name : Delete package-lock.json files
@@ -46,15 +49,19 @@ jobs:
4649 # The 'if' statement prevents an error if no lock files were found.
4750 if [[ -n $(git status -s) ]]; then
4851 git add .
49- git commit -m "chore: remove package-lock.json files before rebase"
52+ git commit -m "chore: remove package-lock.json files before rebase and regenerating after "
5053 else
5154 echo "No package-lock.json files found to delete."
5255 fi
5356
54- # Step 6: Attempt to rebase the branch. The job will fail if this step fails.
55- - name : Rebase adyenExpressPaymentsDreamForceTestAlertBranch with develop
57+ # Step 6: Attempt to rebase the branch. If this step fails, we abort the rebase and
58+ # return the branch to its original state
59+ - name : Rebase adyenExpressPayments with develop
5660 run : |
57- if ! git rebase origin/develop; then
61+ TRIGGERING_TAG="${{ github.ref_name }}"
62+ echo "🔄 Rebasing branch 'adyenExpressPayments' onto tag '$TRIGGERING_TAG'"
63+
64+ if ! git rebase $TRIGGERING_TAG; then
5865 echo "Rebase failed due to conflicts. Aborting."
5966 git rebase --abort
6067 exit 1
@@ -63,11 +70,18 @@ jobs:
6370 # Step 7: Install dependencies after a successful rebase.
6471 # The '--yes' flag for lerna is crucial for non-interactive environments.
6572 - name : Install Dependencies
66- run : npx lerna clean --yes && npm i
73+ run : |
74+ if ! npx lerna clean --yes && npm i; then
75+ echo "Generating package-lock files after rebase failed!"
76+ exit 1
77+ fi
6778
6879 # Step 8: Push the changes only if all previous steps were successful.
6980 - name : Push Changes
70- run : git push origin adyenExpressPaymentsDreamForceTestAlertBranch --force-with-lease
81+ run : |
82+ git add .
83+ git commit --amend --no-edit
84+ git push origin adyenExpressPayments --force-with-lease
7185
7286 # Step 9: This notification step will run if any of the above steps fail.
7387 - name : Notify on Failure
7791 # The channel or user ID to send the notification to.
7892 channel-id : ' ${{ secrets.AGENT_CHECKOUT_ALERT_SLACK_CHANNEL_ID }}'
7993 # A custom message for the Slack notification.
80- slack-message : " 🚨 Automatic rebase of `adyenExpressPaymentsDreamForceTestAlertBranch ` failed. Manual intervention is required. Link to failed action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
94+ slack-message : " 🚨 Automatic rebase of `adyenExpressPayments ` failed. Manual intervention is required. Link to failed action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
8195 env :
8296 # You must store your Slack Bot Token as a secret in your repository settings.
8397 SLACK_BOT_TOKEN : ' ${{ secrets.AGENT_CHECKOUT_SLACK_BOT_TOKEN }}'
84- # Forcing a re-index
0 commit comments