[CWS] some container test cleanup #6910
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add Milestone on a Merged PR | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
- "[0-9]+.[0-9]+.x" | |
permissions: {} | |
jobs: | |
add-milestone-pr: | |
name: Add Milestone on PR | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
steps: | |
- name: Checkout datadog-agent repository | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
with: | |
persist-credentials: false | |
- name: Get repo current milestone | |
id: current-milestone | |
run: | | |
if [[ ${GITHUB_REF##*/} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then | |
# If we're on a release branch, set the milestone to the latest release milestone found. | |
MILESTONE=$(gh release list | grep -o $(echo ${GITHUB_REF##*/} | sed 's/x/[0-9]*/g') | sort -uV | tail -1) | |
if [ -z "$MILESTONE" ]; then | |
echo "Error: Couldn't get the latest release milestone from Github." | |
exit 1 | |
fi | |
else | |
# Else use the current_milestone field in the release.json file. | |
MILESTONE=$(cat release.json | jq -r .current_milestone) | |
if [ -z "$MILESTONE" ]; then | |
echo "Error: Couldn't find the current_milestone field in the release.json file." | |
exit 1 | |
fi | |
fi | |
if [[ ! $MILESTONE =~ ^7\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Error: Malformed milestone $MILESTONE. It should be of the form '7.x.y'." | |
exit 1 | |
fi | |
echo "MILESTONE=$MILESTONE" >> "$GITHUB_OUTPUT" | |
- name: Set the merged PR milestone to current_milestone from release.json | |
run: | | |
echo "Setting milestone $MILESTONE to PR $NUMBER." | |
gh issue edit "$NUMBER" --milestone "$MILESTONE" | |
env: | |
NUMBER: ${{ github.event.number }} | |
MILESTONE: ${{ steps.current-milestone.outputs.MILESTONE }} |