diff --git a/.github/actions/code-freeze/action.yml b/.github/actions/code-freeze/action.yml deleted file mode 100644 index ed92ed38ff97..000000000000 --- a/.github/actions/code-freeze/action.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: "Code Freeze PRs" -description: 'Code Freeze PRs' - -inputs: - page_number: - description: "Page number" - required: true - github_token: - description: 'Github token' - required: true - end_freeze: - description: "Start or stop code freeze" - default: "false" - -runs: - using: "composite" - steps: - - uses: octokit/request-action@v2.x - name: 'Get open PRs' - id: prs - with: - route: GET /repos/{owner}/{repo}/pulls - owner: DataDog - repo: dd-trace-dotnet - state: open - per_page: 25 - page: ${{inputs.page_number}} - env: - GITHUB_TOKEN: "${{ inputs.github_token }}" - - - name: 'Update all PRs with Code Freeze status' - shell: bash - env: - github_token: "${{ inputs.github_token }}" - run: | - set -o pipefail - - targetUrl="https://github.com/DataDog/dd-trace-dotnet/actions/workflows/code_freeze_start.yml" - state="failure" - description="A code freeze is in place" - - if ${{ inputs.end_freeze }} ; then - targetUrl="https://github.com/DataDog/dd-trace-dotnet/actions/workflows/code_freeze_end.yml" - state="success" - description="No code freeze is in place" - fi - - 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 0 $arrayLength); do - title=$(echo $json | jq -r ".[$i].title") - echo "Setting code freeze for '$title'" - sha=$(echo $json | jq -r ".[$i].head.sha") - - curl -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: Bearer ${{ env.github_token }}" \ - "https://api.github.com/repos/DataDog/dd-trace-dotnet/statuses/$sha" \ - -d '{"state":"'"$state"'","context":"code_freeze","description":"'"$description"'","target_url":"'"$targetUrl"'"}' - done \ No newline at end of file diff --git a/.github/workflows/code_freeze_end.yml b/.github/workflows/code_freeze_end.yml index 6c3179995789..e2bf39fb535d 100644 --- a/.github/workflows/code_freeze_end.yml +++ b/.github/workflows/code_freeze_end.yml @@ -8,8 +8,8 @@ on: jobs: end_code_freeze: if: | - github.event_name == 'workflow_dispatch' - || (github.event.milestone.title == 'Code Freeze' && github.event.milestone.state == 'closed') + github.event_name == 'workflow_dispatch' || + (github.event.milestone.title == 'Code Freeze' && github.event.milestone.state == 'closed') runs-on: ubuntu-latest permissions: contents: read @@ -35,37 +35,10 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - uses: ./.github/actions/code-freeze - name: 'Unfreeze 25 PRs' + # Unfreeze PRs + - uses: ./.github/actions/pr-status-updater + name: 'Unfreeze PRs' with: - page_number: 1 github_token: ${{ secrets.GITHUB_TOKEN }} - end_freeze: "true" - - - uses: ./.github/actions/code-freeze - name: 'Unfreeze 25 PRs' - with: - page_number: 2 - github_token: ${{ secrets.GITHUB_TOKEN }} - end_freeze: "true" - - - uses: ./.github/actions/code-freeze - name: 'Unfreeze 25 PRs' - with: - page_number: 3 - github_token: ${{ secrets.GITHUB_TOKEN }} - end_freeze: "true" - - - uses: ./.github/actions/code-freeze - name: 'Unfreeze 25 PRs' - with: - page_number: 5 - github_token: ${{ secrets.GITHUB_TOKEN }} - end_freeze: "true" - - - uses: ./.github/actions/code-freeze - name: 'Unfreeze 25 PRs' - with: - page_number: 4 - github_token: ${{ secrets.GITHUB_TOKEN }} - end_freeze: "true" + state: failure + workflow_name: code_freeze_end.yml # this allows for a click through to go to the action \ No newline at end of file diff --git a/.github/workflows/code_freeze_start.yml b/.github/workflows/code_freeze_start.yml index 547ff0857dd7..8239e02370a9 100644 --- a/.github/workflows/code_freeze_start.yml +++ b/.github/workflows/code_freeze_start.yml @@ -36,35 +36,12 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - uses: ./.github/actions/code-freeze - name: 'Freeze 25 PRs' + - uses: ./.github/actions/pr-status-updater + name: 'Freeze PRs' with: - page_number: 1 - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./.github/actions/code-freeze - name: 'Freeze 25 PRs' - with: - page_number: 2 - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./.github/actions/code-freeze - name: 'Freeze 25 PRs' - with: - page_number: 3 - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./.github/actions/code-freeze - name: 'Freeze 25 PRs' - with: - page_number: 4 - github_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ./.github/actions/code-freeze - name: 'Freeze 25 PRs' - with: - page_number: 5 github_token: ${{ secrets.GITHUB_TOKEN }} + state: failure + workflow_name: code_freeze_start.yml # this allows for a click through to go to the action - uses: ./.github/actions/deploy-aas-dev-apps name: 'Trigger AAS deploy'