diff options
| author | seth <[email protected]> | 2023-10-08 14:19:19 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-10-17 17:19:43 -0400 |
| commit | fa5e5229e1cd5eefade7d5d8f44ca19561b00344 (patch) | |
| tree | b1aaf5693149ea23ffa3c5662e73a5e54e0694b7 /.github/workflows | |
| parent | b70643d09a5bbcd72aceb425548f4b4515b056ca (diff) | |
actions: dont make a pr for staging if one exists
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/staging-automerge.yaml | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/.github/workflows/staging-automerge.yaml b/.github/workflows/staging-automerge.yaml index 101a254..4cbdfaa 100644 --- a/.github/workflows/staging-automerge.yaml +++ b/.github/workflows/staging-automerge.yaml @@ -14,11 +14,35 @@ jobs: pull-requests: write steps: + - name: check if pr exists + id: check + run: | + { + echo 'skip<<EOF' + prs=$(gh pr list \ + --repo ${{ github.repository }} \ + --head staging \ + --json state \ + --jq 'map(select(.state == "OPEN")) | length') + + if (( prs > 0 )); then + echo true + else + echo false + fi + echo EOF + } >> "$GITHUB_OUTPUT" + + env: + GITHUB_TOKEN: ${{ github.token }} + - uses: actions/checkout@v4 + if: "!steps.check.outputs.skip" with: fetch-depth: 0 - name: create pr + if: "!steps.check.outputs.skip" run: | gh pr create \ --base main \ @@ -28,8 +52,8 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - name: enable auto-merge + if: "!steps.check.outputs.skip" run: gh pr merge --auto --rebase --match-head-commit ${{ github.sha }} env: GITHUB_TOKEN: ${{ github.token }} |
