1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-04 01:21:03 +03:00

[Minor] Rollback submodule-update.yml

This commit is contained in:
David Sangrey 2023-11-30 13:27:04 -05:00 committed by GitHub
parent f4866a7a2b
commit f14fdd7e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,11 @@
---
name: Submodule Updates name: Submodule Updates
on: on:
push: push:
branches: [develop] branches: [ develop ]
# schedule: # schedule:
# - cron: '0 12 * * *' # - cron: '0 12 * * *'
jobs: jobs:
check_submodules: check_submodules:
@ -43,44 +44,25 @@ jobs:
echo 'changes=false' >> $GITHUB_OUTPUT echo 'changes=false' >> $GITHUB_OUTPUT
fi fi
exit 0 exit 0
- name: Create or Update submodules changes branch - name: Create submodules changes branch
if: steps.check_for_changes.outputs.changes == 'true' if: steps.check_for_changes.outputs.changes == 'true'
run: | run: |
git fetch origin "submodule-change/$GITHUB_RUN_ID" || git checkout -b "submodule-change/$GITHUB_RUN_ID" $CHECKOUT_BRANCH git checkout -b "submodule-change/$GITHUB_RUN_ID" $CHECKOUT_BRANCH
git commit -am "updating submodules" git commit -am "updating submodules"
git push --set-upstream origin "submodule-change/$GITHUB_RUN_ID" git push --set-upstream origin "submodule-change/$GITHUB_RUN_ID"
- name: Create or Update pull request against target branch - name: Create pull request against target branch
if: steps.check_for_changes.outputs.changes == 'true' if: steps.check_for_changes.outputs.changes == 'true'
uses: actions/github-script@v6 uses: actions/github-script@v6
with: with:
github-token: "${{ secrets.GITHUB_TOKEN }}" github-token: "${{ secrets.GITHUB_TOKEN }}"
script: | script: |
const { data: pulls } = await github.rest.pulls.list({ await github.rest.pulls.create({
owner: '${{ github.repository_owner }}', owner: '${{ github.repository_owner }}',
repo: '${{ github.repository }}'.split('/')[1].trim(), repo: '${{ github.repository }}'.split('/')[1].trim(),
head: 'submodule-change/${{ github.run_id }}', head: 'submodule-change/${{ github.run_id }}',
base: '${{ env.PR_AGAINST_BRANCH }}', base: '${{ env.PR_AGAINST_BRANCH }}',
state: 'open', title: `[Auto-generated] Submodule Updates ${process.env.GITHUB_RUN_ID}`,
body: '${{ steps.check_for_changes.outputs.changes_text }}',
}); });
if (pulls.length > 0) {
// If an open pull request exists, update it
const pull_number = pulls[0].number;
await github.rest.pulls.update({
owner: '${{ github.repository_owner }}',
repo: '${{ github.repository }}'.split('/')[1].trim(),
pull_number,
body: '${{ steps.check_for_changes.outputs.changes_text }}',
});
} else {
// If no open pull request exists, create a new one
await github.rest.pulls.create({
owner: '${{ github.repository_owner }}',
repo: '${{ github.repository }}'.split('/')[1].trim(),
head: 'submodule-change/${{ github.run_id }}',
base: '${{ env.PR_AGAINST_BRANCH }}',
title: `[Auto-generated] Submodule Updates ${process.env.GITHUB_RUN_ID}`,
body: '${{ steps.check_for_changes.outputs.changes_text }}',
});
}