fix: gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_T… #10
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
name: Create production promotion pull request | |
on: | |
push: | |
branches: | |
- 'hotfix/*' # Trigger for hotfix branches | |
workflow_dispatch: | |
jobs: | |
promote-hotfix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Verify if PR already open | |
env: | |
GH_TOKEN: ${{ secrets.PAT }} | |
run: | | |
prs_list=$(gh pr list --search "${{ github.ref_name }}") | |
echo "${prs_list}" | |
for pr in $prs_list; do | |
echo ${pr} | |
done | |
if: ${ ${#prs_list} > 0 } | |
then | |
echo "PR already opened" | |
exit 0 | |
fi | |
- name: create pull request | |
run: gh pr create -B main -H ${{ github.ref_name }} --title 'Merge ${{ github.ref_name }} into main' --body 'Created by Github action' | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} |