SDK Generation for MySQL FlexibleServers TypeSpec Project (API Version 2024-12-30) #27345
This file contains hidden or 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: SDK Suppressions | |
on: | |
pull_request: | |
types: | |
# default | |
- opened | |
- synchronize | |
- reopened | |
# re-run if base branch is changed, since previous merge commit may generate incorrect diff | |
- edited | |
branches: | |
- main | |
- RPSaaSMaster | |
- release* | |
permissions: | |
contents: read | |
jobs: | |
process-sdk-suppressions-labels: | |
name: Sdk Suppressions | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# Required since "HEAD^" is passed to Get-ChangedFiles | |
fetch-depth: 2 | |
- name: Setup Node and install deps | |
uses: ./.github/actions/setup-node-install-deps | |
- name: Get GitHub PullRequest Context | |
uses: actions/github-script@v7 | |
id: fetch-pullRequest-context | |
with: | |
script: | | |
const pr = context.payload.pull_request; | |
if (!pr) { | |
throw new Error("This workflow must run in the context of a pull request."); | |
} | |
console.log("This action trigger by", context.eventName); | |
core.setOutput("prLabels", pr.labels.map(label => label.name)); | |
result-encoding: string | |
- name: Run Get suppressions Label Script | |
id: run-suppressions-script | |
env: | |
OUTPUT_FILE: "output.json" | |
GITHUB_PULL_REQUEST_LABELS: ${{ steps.fetch-pullRequest-context.outputs.prLabels }} | |
run: | | |
node eng/tools/sdk-suppressions/cmd/sdk-suppressions-label.js HEAD^ HEAD "$GITHUB_PULL_REQUEST_LABELS" | |
OUTPUT=$(cat "$OUTPUT_FILE") | |
echo "Script output labels: $OUTPUT" | |
labelsToAdd=$(echo "$OUTPUT" | sed -n 's/.*"labelsToAdd":\[\([^]]*\)\].*/\1/p' | tr -d '" ') | |
labelsToRemove=$(echo "$OUTPUT" | sed -n 's/.*"labelsToRemove":\[\([^]]*\)\].*/\1/p' | tr -d '" ') | |
for label in $(echo "$labelsToAdd" | tr ',' '\n'); do | |
echo "Label to add: $label" | |
echo "$label=true" >> "$GITHUB_OUTPUT" | |
done | |
for label in $(echo "$labelsToRemove" | tr ',' '\n'); do | |
echo "Label to remove: $label" | |
echo "$label=false" >> "$GITHUB_OUTPUT" | |
done | |
# No Action or Add/Remove label according to step run-suppressions-script output | |
# e.g. | |
# If the output of the step does not include the BreakingChange-Go-Sdk-Suppression, no action will be taken. | |
# If the step's output is "BreakingChange-Go-Sdk-Suppression='true'", the label "BreakingChange-Go-Sdk-Suppression" will be applied to the PR. | |
# If the step's output is "BreakingChange-Go-Sdk-Suppression='false'", the label "BreakingChange-Go-Sdk-Suppression" will be removed from the PR. | |
- uses: ./.github/actions/add-label-artifact | |
name: Upload artifact with results-go | |
if: ${{ steps.run-suppressions-script.outputs.BreakingChange-Go-Sdk-Suppression }} | |
with: | |
name: "BreakingChange-Go-Sdk-Suppression" | |
value: "${{ steps.run-suppressions-script.outputs.BreakingChange-Go-Sdk-Suppression == 'true' }}" | |
- uses: ./.github/actions/add-label-artifact | |
name: Upload artifact with results java | |
if: ${{ steps.run-suppressions-script.outputs.BreakingChange-Java-Sdk-Suppression }} | |
with: | |
name: "BreakingChange-Java-Sdk-Suppression" | |
value: "${{ steps.run-suppressions-script.outputs.BreakingChange-Java-Sdk-Suppression == 'true' }}" | |
- uses: ./.github/actions/add-label-artifact | |
name: Upload artifact with results js | |
if: ${{ steps.run-suppressions-script.outputs.BreakingChange-JavaScript-Sdk-Suppression }} | |
with: | |
name: "BreakingChange-JavaScript-Sdk-Suppression" | |
value: "${{ steps.run-suppressions-script.outputs.BreakingChange-JavaScript-Sdk-Suppression == 'true' }}" | |
- uses: ./.github/actions/add-label-artifact | |
name: Upload artifact with results python | |
if: ${{ steps.run-suppressions-script.outputs.BreakingChange-Python-Sdk-Suppression }} | |
with: | |
name: "BreakingChange-Python-Sdk-Suppression" | |
value: "${{ steps.run-suppressions-script.outputs.BreakingChange-Python-Sdk-Suppression == 'true' }}" |