Skip to content

Add additional exclusions for dependency collection #18326

Add additional exclusions for dependency collection

Add additional exclusions for dependency collection #18326

name: Auto Block PR on Code Freeze
on:
pull_request:
branches:
- 'main'
- 'master'
- 'release/**'
- 'hotfix/**'
jobs:
check_for_code_freeze:
runs-on: ubuntu-latest
permissions:
contents: read
issues: read # need to read milestones
statuses: write # add a commit status check
steps:
- uses: octokit/[email protected]
name: 'Get Milestones'
id: milestones
with:
route: GET /repos/{owner}/{repo}/milestones
owner: DataDog
repo: dd-trace-dotnet
state: open
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- run: |
set -o pipefail
sha="${{ github.event.pull_request.head.sha }}"
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 $json | jq -er '.[] | select(.title == "Code Freeze")'); then
state="failure"
description="A code freeze is in place"
fi
echo "$description, setting check status $state"
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/DataDog/dd-trace-dotnet/statuses/$sha" \
-d '{"state":"'"$state"'","context":"code_freeze","description":"'"$description"'","target_url":"'"$targetUrl"'"}'
name: 'Check Code Freeze status'