Skip to content

Commit

Permalink
Fix code-freeze bot (part deux) (#2885)
Browse files Browse the repository at this point in the history
* Add missing heredoc for auto-block code freeze bot

* Try fixing the heredocs

* doh, zero index
  • Loading branch information
andrewlock authored Jun 8, 2022
1 parent 6487613 commit 49c3f4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/auto_code_freeze_block_pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Block PR on Code Freeze
name: Auto Block PR on Code Freeze

on:
pull_request:
Expand All @@ -25,8 +25,12 @@ jobs:
targetUrl="https://github.com/DataDog/dd-trace-dotnet/actions/workflows/auto_code_freeze_block_pr.yml"
state="success"
description="No code freeze is in place"
json=$(cat << 'ENDOFMESSAGE'
${{ steps.milestones.outputs.data }}
ENDOFMESSAGE
)
if addr=$(echo "${{ steps.milestones.outputs.data }}" | jq -er '.[] | select(.title == "Code Freeze")'); then
if addr=$(echo $json | jq -er '.[] | select(.title == "Code Freeze")'); then
state="failure"
description="A code freeze is in place"
fi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code_freeze_end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ jobs:

- run: |
set -o pipefail
json=$(cat << ENDOFMESSAGE
json=$(cat << 'ENDOFMESSAGE'
${{ steps.prs.outputs.data }}
ENDOFMESSAGE
)
arrayLength=$(echo $json | jq -r 'length')
echo "Updating code freeze status for $arrayLength PRs"
arrayLength=$((arrayLength-1))
for i in $(seq 1 $arrayLength); do
for i in $(seq 0 $arrayLength); do
title=$(echo $json | jq -r ".[$i].title")
echo "Removing code freeze for '$title'"
sha=$(echo $json | jq -r ".[$i].head.sha")
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code_freeze_start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ jobs:

- run: |
set -o pipefail
json=$(cat << ENDOFMESSAGE
json=$(cat << 'ENDOFMESSAGE'
${{ steps.prs.outputs.data }}
ENDOFMESSAGE
)
arrayLength=$(echo $json | jq -r 'length')
echo "Updating code freeze status for $arrayLength PRs"
arrayLength=$((arrayLength-1))
for i in $(seq 1 $arrayLength); do
for i in $(seq 0 $arrayLength); do
title=$(echo $json | jq -r ".[$i].title")
echo "Setting code freeze for '$title'"
sha=$(echo $json | jq -r ".[$i].head.sha")
Expand Down

0 comments on commit 49c3f4c

Please sign in to comment.