azurerm_kubernetes_cluster - add policy property to network_profile.advanced_networking block
#367
Workflow file for this run
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: TeamCity Remove Label on Commit | |
| on: | |
| pull_request_target: | |
| types: [synchronize] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| apply-outdated-label: | |
| runs-on: ubuntu-latest | |
| env: | |
| TEAMCITY_LABELS: teamcity-passed,teamcity-failed,teamcity-new-failure | |
| OUTDATED_LABEL: teamcity-outdated | |
| PASSED_LABEL: teamcity-passed | |
| steps: | |
| - name: Check for TeamCity labels and apply outdated label | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const teamcityLabels = process.env.TEAMCITY_LABELS.split(','); | |
| const outdatedLabel = process.env.OUTDATED_LABEL; | |
| const passedLabel = process.env.PASSED_LABEL; | |
| const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number | |
| }); | |
| const labelNames = labels.map(label => label.name); | |
| const hasTeamCityLabel = teamcityLabels.some(label => labelNames.includes(label)); | |
| const hasOutdatedLabel = labelNames.includes(outdatedLabel); | |
| const hasPassedLabel = labelNames.includes(passedLabel); | |
| if (hasTeamCityLabel) { | |
| const foundLabels = teamcityLabels.filter(label => labelNames.includes(label)); | |
| core.info(`Found TeamCity labels: ${foundLabels.join(', ')}`); | |
| if (!hasOutdatedLabel) { | |
| core.info(`Applying "${outdatedLabel}" label to PR #${context.payload.pull_request.number}`); | |
| try { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| labels: [outdatedLabel] | |
| }); | |
| core.info(`Successfully applied "${outdatedLabel}" label`); | |
| } catch (error) { | |
| core.error(`Failed to apply "${outdatedLabel}" label: ${error.message}`); | |
| throw error; | |
| } | |
| } else { | |
| core.info(`Label "${outdatedLabel}" already exists on PR #${context.payload.pull_request.number}`); | |
| } | |
| // Remove passed label if it exists | |
| if (hasPassedLabel) { | |
| core.info(`Removing "${passedLabel}" label from PR #${context.payload.pull_request.number}`); | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| name: passedLabel | |
| }); | |
| core.info(`Successfully removed "${passedLabel}" label`); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| core.warning(`Label "${passedLabel}" was not found on PR #${context.payload.pull_request.number}`); | |
| } else { | |
| core.error(`Failed to remove "${passedLabel}" label: ${error.message}`); | |
| throw error; | |
| } | |
| } | |
| } | |
| } else { | |
| core.info(`No TeamCity labels found on PR #${context.payload.pull_request.number}`); | |
| } |