-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update tokens workflow (#3954)
Updated the tokens PR workflow to: - have only one merging branch to prevent overriding changes from the current month with changes from the past month, - stop merging the main branch into the token branch, merge it into the merging branch instead
- Loading branch information
1 parent
81859a1
commit acb910e
Showing
1 changed file
with
12 additions
and
13 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 |
---|---|---|
|
@@ -25,19 +25,11 @@ jobs: | |
git config user.name "Swiss Post Bot" | ||
git config user.email "[email protected]" | ||
- name: Update Tokens Branch | ||
run: | | ||
git checkout ${{ github.ref_name }} | ||
git merge origin/main -X ours --no-edit | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }} | ||
|
||
# Check if a PR branch corresponding to the token branch exists | ||
# Check if a PR branch already exists | ||
- name: Get PR Branch | ||
id: pr-branch | ||
run: | | ||
PR_BRANCH="merge-tokens-${GITHUB_REF##*/}" | ||
PR_BRANCH="update-tokens" | ||
echo "name=${PR_BRANCH}" >> $GITHUB_OUTPUT | ||
if [[ -n $(git ls-remote origin "${PR_BRANCH}") ]]; then | ||
|
@@ -46,7 +38,7 @@ jobs: | |
echo "exists=false" >> $GITHUB_OUTPUT | ||
fi | ||
# If the branch does not exit, create it | ||
# If the PR branch does not exit, create it | ||
- name: Create PR Branch | ||
if: steps.pr-branch.outputs.exists == 'false' | ||
run: | | ||
|
@@ -55,12 +47,19 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }} | ||
|
||
# If the branch exits, update it | ||
- name: Update PR Branch | ||
# If the PR branch exits, update it with the tokens branch | ||
- name: Update PR Branch with Tokens Branch | ||
if: steps.pr-branch.outputs.exists == 'true' | ||
run: | | ||
git checkout ${{ steps.pr-branch.outputs.name }} | ||
git merge ${{ github.ref_name }} -X theirs --no-edit | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }} | ||
|
||
# Always update the PR branch with the main branch | ||
- name: Update PR Branch with main | ||
run: | | ||
git merge origin/main -X ours --no-edit | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }} | ||
|