Skip to content

Commit

Permalink
Update create-token-pr.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
alizedebray committed Nov 6, 2024
1 parent d0bdc3d commit 1c8584d
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/create-token-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ jobs:
echo "exists=false" >> $GITHUB_OUTPUT
fi
# If the branch exits, update the PR
- name: Update PR
# If the branch does not exit, create it
- name: Create PR Branch
if: steps.pr-branch.outputs.exists == 'false'
run: |
git checkout -b ${{ steps.pr-branch.outputs.name }} ${{ github.ref_name }}
git push --set-upstream origin ${{ steps.pr-branch.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}

# If the branch exits, update it
- name: Update PR Branch
if: steps.pr-branch.outputs.exists == 'true'
run: |
git checkout ${{ steps.pr-branch.outputs.name }}
Expand All @@ -56,12 +65,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}

# If the branch does not exit, create the PR
# Check if a PR already exist
- name: Get PR
id: pr
run: |
if [[ -n $(gh pr list --head "${PR_BRANCH}") ]]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
# If the PR does not exit, create it
- name: Create PR
if: steps.pr-branch.outputs.exists == 'false'
if: steps.pr.outputs.exists == 'false'
run: |
git checkout -b ${{ steps.pr-branch.outputs.name }} ${{ github.ref_name }}
git push --set-upstream origin ${{ steps.pr-branch.outputs.name }}
gh pr create --title "chore(tokens): :art: update tokens" --body "Merge this PR to update the tokens in the main branch." --base main
gh pr create --title "TEST" --body "Merge this PR to update the tokens in the main branch." --base main
env:
GITHUB_TOKEN: ${{ secrets.SWISSPOSTDEVS_ACCESS_TOKEN }}

0 comments on commit 1c8584d

Please sign in to comment.