Skip to content

Commit b69929b

Browse files
mudit2812rashidnhm
andauthored
Update update-dev.yml to use git instead of third-party action (#1242)
The `update-dev` action keeps failing due to unrelated histories between the `dev` and `master` branches, and the third party action used for the nightly merge does not include any options to allow merging with unrelated histories. So, this PR updates the action to use `git` instead. This will also give us more flexibility in the future. Couple of updates: * I have confirmed that configuring `git` using `secrets.NIGHTLY_TOKEN` does not expose the token in the workflow logs. See [here](https://github.com/PennyLaneAI/qml/actions/runs/11408914907/job/31748090296#step:3:4) for an example. [sc-76254] --------- Co-authored-by: Rashid N H M <95639609+rashidnhm@users.noreply.github.com>
1 parent 070e0c1 commit b69929b

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/update-dev.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,28 @@ jobs:
2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v4
30+
with:
31+
token: ${{ secrets.NIGHTLY_TOKEN }}
3032

3133
- name: Nightly Merge
32-
uses: robotology/gh-action-nightly-merge@v1.3.3
33-
with:
34-
stable_branch: 'master'
35-
development_branch: 'dev'
36-
allow_ff: false
3734
env:
38-
GITHUB_TOKEN: ${{ secrets.NIGHTLY_TOKEN }}
35+
CONFIG_USERNAME: GitHub Nightly Merge Action
36+
CONFIG_EMAIL: actions@github.com
37+
MERGE_HEAD: master
38+
MERGE_BASE: dev
39+
MERGE_ARGS: --no-ff --allow-unrelated-histories --no-edit
40+
run: |
41+
# This script is adapted from the robotology/gh-action-nightly-merge@v1.5.2 GitHub action:
42+
# https://github.com/robotology/gh-action-nightly-merge/blob/master/entrypoint.sh
43+
44+
git config --global user.name "$CONFIG_USERNAME"
45+
git config --global user.email "$CONFIG_EMAIL"
46+
47+
git fetch origin $MERGE_HEAD
48+
(git checkout $MERGE_HEAD && git pull)
49+
50+
git fetch origin $MERGE_BASE
51+
(git checkout $MERGE_BASE && git pull)
52+
53+
git merge $MERGE_ARGS $MERGE_HEAD
54+
git push origin $MERGE_BASE

0 commit comments

Comments
 (0)