Skip to content

Commit

Permalink
test pr exists
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros committed Jul 19, 2024
1 parent b60df79 commit 9d18aad
Showing 1 changed file with 23 additions and 37 deletions.
60 changes: 23 additions & 37 deletions .github/workflows/merge-acm-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,46 +211,32 @@ jobs:
scope: ${{ steps.org.outputs.sandbox }}
- name: Create Pull Request
if: github.event_name != 'pull_request'
uses: rhobs/acm-create-pull-request@push-to-fork-token
id: create-pr
with:
title: "[bot] Bump ${{ inputs.downstream }} to ${{ steps.upstream.outputs.release }}"
body: |
## Description
This is an automated version bump from CI.
The logs for this run can be found [in the syncbot repo actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
If you wish to perform this manually, execute the following commands from ${{ inputs.downstream }} repo:
```
git fetch https://github.com/${{ inputs.upstream }} --tags
if ! git merge refs/tags/${{ steps.upstream.outputs.release }} --no-edit; then
git checkout --theirs ${{ inputs.restore-upstream }}
git checkout --ours ${{ inputs.restore-downstream }}
git add ${{ inputs.restore-upstream }} ${{ inputs.restore-downstream }}
git merge --continue
fi
go mod tidy
go mod vendor
${{ inputs.assets-cmd }}
if [ -f scripts/rh-manifest.sh ]; then
bash scripts/rh-manifest.sh
git add rh-manifest.txt
git diff --cached --exit-code || git commit -s -m "[bot] update rh-manifest.txt"
fi
```
author: 'github-actions[bot]<github-actions[bot]@users.noreply.github.com>'
committer: 'github-actions[bot]<github-actions[bot]@users.noreply.github.com>'
signoff: true
branch: automated-updates-acm-${{ inputs.downstream-branch }}
delete-branch: true
token: ${{ steps.pr.outputs.token }}
push-to-fork: ${{ inputs.sandbox }}
push-to-fork-token: ${{ steps.cloner.outputs.token }}
- name: Print create_pr output
id: create_pr
run: |
echo "Create PR Output: ${{ steps.create_pr.outputs }}"
rhobs/acm-create-pull-request@push-to-fork-token \
--title "[bot] Bump ${{ inputs.downstream }} to ${{ steps.upstream.outputs.release }}" \
--body "## Description\nThis is an automated version bump from CI.\nThe logs for this run can be found [in the syncbot repo actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).\nIf you wish to perform this manually, execute the following commands from ${{ inputs.downstream }} repo:\n```\ngit fetch https://github.com/${{ inputs.upstream }} --tags\nif ! git merge refs/tags/${{ steps.upstream.outputs.release }} --no-edit; then\ngit checkout --theirs ${{ inputs.restore-upstream }}\ngit checkout --ours ${{ inputs.restore-downstream }}\ngit add ${{ inputs.restore-upstream }} ${{ inputs.restore-downstream }}\ngit merge --continue\nfi\ngo mod tidy\ngo mod vendor\n${{ inputs.assets-cmd }}\nif [ -f scripts/rh-manifest.sh ]; then\nbash scripts/rh-manifest.sh\ngit add rh-manifest.txt\ngit diff --cached --exit-code || git commit -s -m \"[bot] update rh-manifest.txt\"\nfi\n```" \
--author "github-actions[bot]<github-actions[bot]@users.noreply.github.com>" \
--committer "github-actions[bot]<github-actions[bot]@users.noreply.github.com>" \
--signoff true \
--branch "automated-updates-acm-${{ inputs.downstream-branch }}" \
--delete-branch true \
--token "${{ steps.pr.outputs.token }}" \
--push-to-fork "${{ inputs.sandbox }}" \
--push-to-fork-token "${{ steps.cloner.outputs.token }}" \
> output.log 2>&1
- name: Print captured output for debugging
run: cat output.log

- name: Check if PR already exists
id: check_pr
run: echo "pr_exists=$(echo '${{ steps.create_pr.outputs.output }}' | grep -c 'A pull request already exists')" >> $GITHUB_ENV
run: |
if grep -q 'A pull request already exists' output.log; then
echo "pr_exists=1" >> $GITHUB_ENV
else
echo "pr_exists=0" >> $GITHUB_ENV
fi
- name: Compose slack message body
if: github.event_name != 'pull_request' && (success() || steps.fork-sync.outputs.status == 'uptodate' || steps.fork-sync.outputs.status == 'ahead' || env.pr_exists == '1' )
continue-on-error: true
Expand Down

0 comments on commit 9d18aad

Please sign in to comment.