Skip to content

Commit

Permalink
github: write PR data to file before parsing
Browse files Browse the repository at this point in the history
This reverts commit dde864b.
  • Loading branch information
achilleas-k authored and ochosi committed Mar 5, 2024
1 parent d19dc59 commit 28de682
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/trigger-gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ jobs:
- name: Checkout branch
id: pr_data
run: |
PR=$(jq -rc '.[] | select(.head.sha | contains("${{ github.event.workflow_run.head_sha }}")) | select(.state | contains("open"))' <<< ${{ steps.fetch_pulls.outputs.data }} | jq -r .number)
PR_DATA=$(mktemp)
# use uuid as a file terminator to avoid conflicts with data content
cat > "$PR_DATA" <<'a21b3e7f-d5eb-44a3-8be0-c2412851d2e6'
${{ steps.fetch_pulls.outputs.data }}
a21b3e7f-d5eb-44a3-8be0-c2412851d2e6
PR=$(jq -rc '.[] | select(.head.sha | contains("${{ github.event.workflow_run.head_sha }}")) | select(.state | contains("open"))' "$PR_DATA" | jq -r .number)
if [ ! -z "$PR" ]; then
# Create branch named PR-<number> to push to GitLab
echo "pr_branch=PR-$PR" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit 28de682

Please sign in to comment.