Skip to content

Commit b1333b3

Browse files
authored
Update create_conflicts.yml
1 parent 24069f1 commit b1333b3

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

.github/workflows/create_conflicts.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,44 @@ jobs:
5353
5454
target_file="Solutions/Conflict-fixes/${username}-${scenario_file}"
5555
56+
# Compose variant file names (base, 2, 3)
57+
ext="${scenario_file##*.}"
58+
base="${scenario_file%.*}"
59+
file1="${scenario_file}"
60+
file2="${base}2.${ext}"
61+
file3="${base}3.${ext}"
62+
5663
echo "uuid=$uuid" >> $GITHUB_OUTPUT
5764
echo "username=$username" >> $GITHUB_OUTPUT
5865
echo "scenario_file=$scenario_file" >> $GITHUB_OUTPUT
5966
echo "target_file=$target_file" >> $GITHUB_OUTPUT
67+
echo "file1=$file1" >> $GITHUB_OUTPUT
68+
echo "file2=$file2" >> $GITHUB_OUTPUT
69+
echo "file3=$file3" >> $GITHUB_OUTPUT
6070
61-
- name: Copy stub and commit to main
71+
- name: Copy stub and commit to main (version 1 file)
6272
run: |
63-
cp "Tasks/Conflicts/${{ steps.vars.outputs.scenario_file }}" "${{ steps.vars.outputs.target_file }}"
64-
echo "// version A for ${{ steps.vars.outputs.username }}" >> "${{ steps.vars.outputs.target_file }}"
73+
cp "Tasks/Conflicts/${{ steps.vars.outputs.file1 }}" "${{ steps.vars.outputs.target_file }}"
6574
git add "${{ steps.vars.outputs.target_file }}"
66-
git commit -m "Add scenario file for ${{ steps.vars.outputs.username }}"
75+
git commit -m "Add scenario file for ${{ steps.vars.outputs.username }} (version 1)"
6776
git push origin main
6877
69-
- name: Create conflict branch and modify file
78+
- name: Create conflict branch and overwrite with version 3
7079
run: |
7180
git checkout -b conflict-${{ steps.vars.outputs.uuid }}
72-
echo "// version B for ${{ steps.vars.outputs.username }}" >> "${{ steps.vars.outputs.target_file }}"
81+
cp "Tasks/Conflicts/${{ steps.vars.outputs.file3 }}" "${{ steps.vars.outputs.target_file }}"
7382
git add "${{ steps.vars.outputs.target_file }}"
74-
git commit -m "Introduce conflicting change for ${{ steps.vars.outputs.username }}"
83+
git commit -m "Introduce conflicting change for ${{ steps.vars.outputs.username }} (version 3)"
7584
git push origin conflict-${{ steps.vars.outputs.uuid }}
7685
86+
- name: Generate actual conflict in main (overwrite with version 2)
87+
run: |
88+
git switch main
89+
cp "Tasks/Conflicts/${{ steps.vars.outputs.file2 }}" "${{ steps.vars.outputs.target_file }}"
90+
git add "${{ steps.vars.outputs.target_file }}"
91+
git commit -m "Introduce conflicting change for ${{ steps.vars.outputs.username }} (version 2)"
92+
git push origin main
93+
7794
- name: Comment with next steps
7895
uses: actions/github-script@v7
7996
env:
@@ -91,8 +108,8 @@ jobs:
91108
repo: context.repo.repo,
92109
body: `🎉 Conflict scenario ready for **@${username}**
93110
94-
🔹 Branch \`main\`: version A
95-
🔹 Branch \`conflict-${uuid}\`: version B
111+
🔹 Branch \`main\`: version 2
112+
🔹 Branch \`conflict-${uuid}\`: version 3
96113
97114
File to resolve:
98115
\`Solutions/Conflict-fixes/${username}-${scenario_file}\`

0 commit comments

Comments
 (0)