change picklist field #106
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: Pull Request Action | |
'on': | |
push: | |
branches: | |
- dev | |
jobs: | |
create-pull-request: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if PR exists | |
id: check | |
run: | | |
prs=$(gh pr list --repo "$GITHUB_REPOSITORY" \ | |
--json baseRefName,headRefName \ | |
--jq ' | |
map(select(.baseRefName == "master" and .headRefName == "dev")) | |
| length | |
') | |
if ((prs > 0)); then | |
echo "skip=true" >> "$GITHUB_OUTPUT" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create pull request | |
if: steps.check.outputs.skip != 'true' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { repo, owner } = context.repo; | |
const result = await github.rest.pulls.create({ | |
title: 'Master Sync : Auto Generated PR', | |
owner, | |
repo, | |
head: '${{ github.ref_name }}', | |
base: 'master', | |
body: [ | |
'This PR is auto-generated by', | |
'[actions/github-script](https://github.com/actions/github-script).' | |
].join('\n') | |
}); | |
github.rest.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: result.data.number, | |
labels: ['feature', 'automated pr'] | |
}); |