Skip to content

Commit 94e31be

Browse files
committed
feat: add job step
1 parent b1111f0 commit 94e31be

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,39 @@ jobs:
229229
DOCSTRING: false
230230
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
231231
secrets: inherit
232+
233+
sync-main-with-master:
234+
name: "Sync main with master"
235+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
236+
runs-on: ubuntu-latest
237+
steps:
238+
- name: "Install Git and clone project"
239+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
240+
with:
241+
token: ${{ secrets.GITHUB_TOKEN }}
242+
fetch-depth: 0
243+
244+
- name: "Verify that main is the default branch"
245+
shell: bash
246+
run: |
247+
head_branch=$(git remote show origin | grep "HEAD branch:")
248+
main_branch=${head_branch#*: }
249+
250+
if [[ $main_branch != "main" ]]; then
251+
echo "The default branch is not 'main'. It is set to '$main_branch'."
252+
echo "Please set 'main' as the default branch in the repository settings."
253+
exit 1
254+
fi
255+
256+
- name: "Configure git username and email"
257+
shell: bash
258+
run: |
259+
git config --global user.name "${{ secrets.PYANSYS_CI_BOT_USERNAME }}"
260+
git config --global user.email "${{ secrets.PYANSYS_CI_BOT_EMAIL }}"
261+
262+
- name: "Sync main to master"
263+
shell: bash
264+
run: |
265+
git checkout master
266+
git reset --hard main
267+
git push

0 commit comments

Comments
 (0)