Skip to content

Commit b8cc906

Browse files
committed
Update create-token-pr.yaml
1 parent d6a32e7 commit b8cc906

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed

.github/workflows/create-token-pr.yaml

+10-34
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,7 @@ jobs:
2525
git config user.name "Swiss Post Bot"
2626
git config user.email "[email protected]"
2727
28-
- name: Update Tokens Branch
29-
run: |
30-
git checkout ${{ github.ref_name }}
31-
git merge origin/main -X ours --no-edit
32-
git push
33-
env:
34-
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
35-
36-
# Check if a PR branch corresponding to the token branch exists
28+
# Check if a PR branch exists
3729
- name: Get PR Branch
3830
id: pr-branch
3931
run: |
@@ -46,40 +38,24 @@ jobs:
4638
echo "exists=false" >> $GITHUB_OUTPUT
4739
fi
4840
49-
# If the branch does not exit, create it
50-
- name: Create PR Branch
51-
if: steps.pr-branch.outputs.exists == 'false'
52-
run: |
53-
git checkout -b ${{ steps.pr-branch.outputs.name }} ${{ github.ref_name }}
54-
git push --set-upstream origin ${{ steps.pr-branch.outputs.name }}
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
57-
58-
# If the branch exits, update it
59-
- name: Update PR Branch
41+
# If the branch exits, delete it
42+
- name: Delete PR Branch
6043
if: steps.pr-branch.outputs.exists == 'true'
6144
run: |
62-
git checkout ${{ steps.pr-branch.outputs.name }}
63-
git merge ${{ github.ref_name }} -X theirs --no-edit
64-
git push
45+
git push origin --delete ${{ steps.pr-branch.outputs.name }}
6546
env:
6647
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
6748

68-
# Check if a PR already exist
69-
- name: Get PR
70-
id: pr
49+
# Create a new PR branch
50+
- name: Create New PR Branch
7151
run: |
72-
if [[ -n $(gh pr list --head "${{ steps.pr-branch.outputs.name }}") ]]; then
73-
echo "exists=true" >> $GITHUB_OUTPUT
74-
else
75-
echo "exists=false" >> $GITHUB_OUTPUT
76-
fi
52+
git checkout -b ${{ steps.pr-branch.outputs.name }} ${{ github.ref_name }}
53+
git push --set-upstream origin ${{ steps.pr-branch.outputs.name }}
7754
env:
7855
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
7956

80-
# If the PR does not exit, create it
81-
- name: Create PR
82-
if: steps.pr.outputs.exists == 'false'
57+
# Create a New PR from the PR branch
58+
- name: Create New PR
8359
run: |
8460
gh pr create --title "chore(tokens): :art: update tokens" --body "Merge this PR to update the tokens in the main branch." --base main
8561
env:

0 commit comments

Comments
 (0)