-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
235efa1
commit c633c86
Showing
1 changed file
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,12 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Pull latest changes for update-changelog branch | ||
run: | | ||
git fetch origin | ||
git checkout -B update-changelog origin/update-changelog || git checkout -b update-changelog | ||
git pull origin update-changelog --rebase | ||
- name: Setup Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
|
@@ -43,11 +49,9 @@ jobs: | |
git diff-index --quiet HEAD || git commit -m "Auto cl update" | ||
continue-on-error: true | ||
|
||
- name: Pull latest changes for update-changelog branch | ||
- name: Merge changes with ours strategy | ||
if: steps.commit-changes.outcome == 'success' | ||
run: | | ||
git fetch origin | ||
git checkout -B update-changelog origin/update-changelog || git checkout -b update-changelog | ||
git merge -X ours origin/update-changelog || echo "No changes to merge" | ||
- name: Push changes to a new branch | ||
|
@@ -61,17 +65,18 @@ jobs: | |
id: pr-check | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { data: pullRequests } = await github.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
head: `${context.repo.owner}:update-changelog` | ||
}); | ||
return pullRequests.length > 0; | ||
core.setOutput('pr_exists', pullRequests.length > 0 ? 'true' : 'false'); | ||
- name: Create Pull Request | ||
if: steps.commit-changes.outcome == 'success' && steps.pr-check.outputs.result == 'false' | ||
if: steps.commit-changes.outcome == 'success' && steps.pr-check.outputs.pr_exists == 'false' | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|