25
25
git config user.name "Swiss Post Bot"
26
26
git config user.email "[email protected] "
27
27
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
37
29
- name : Get PR Branch
38
30
id : pr-branch
39
31
run : |
@@ -46,40 +38,24 @@ jobs:
46
38
echo "exists=false" >> $GITHUB_OUTPUT
47
39
fi
48
40
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
60
43
if : steps.pr-branch.outputs.exists == 'true'
61
44
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 }}
65
46
env :
66
47
GITHUB_TOKEN : ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
67
48
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
71
51
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 }}
77
54
env :
78
55
GITHUB_TOKEN : ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}
79
56
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
83
59
run : |
84
60
gh pr create --title "chore(tokens): :art: update tokens" --body "Merge this PR to update the tokens in the main branch." --base main
85
61
env :
0 commit comments