Skip to content

Commit 024f85a

Browse files
authored
Merge branch 'staged' into workflow_cost
2 parents b4b29db + 9aa4f61 commit 024f85a

4 files changed

Lines changed: 297 additions & 18 deletions

File tree

.codespellrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252

5353
# FO - tasklist option /FO to format running task output
5454

55-
ignore-words-list = numer,wit,aks,edn,ser,ois,gir,rouge,categor,aline,ative,afterall,deques,dateA,dateB,TE,FillIn,alle,vai,LOD,InOut,pixelX,aNULL,Wee,Sherif,queston,Vertexes,nin,FO
55+
# CAF - Microsoft Cloud Adoption Framework acronym
56+
57+
ignore-words-list = numer,wit,aks,edn,ser,ois,gir,rouge,categor,aline,ative,afterall,deques,dateA,dateB,TE,FillIn,alle,vai,LOD,InOut,pixelX,aNULL,Wee,Sherif,queston,Vertexes,nin,FO,CAF
5658

5759
# Skip certain files and directories
5860

.github/workflows/contributor-check.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Contributor Reputation Check
22

33
on:
44
pull_request_target:
5-
types: [opened]
5+
types: [opened, synchronize, reopened, edited, ready_for_review]
66
issues:
7-
types: [opened]
7+
types: [opened, reopened, edited]
88

99
permissions:
1010
contents: read
@@ -183,21 +183,34 @@ jobs:
183183
esac
184184
echo "risk=$r" >> "$GITHUB_OUTPUT"
185185
186-
- name: Comment on MEDIUM or HIGH risk
187-
if: steps.overall.outputs.risk == 'MEDIUM' || steps.overall.outputs.risk == 'HIGH'
186+
- name: Sync risk comment
188187
env:
189188
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190189
run: |
191190
number="${{ steps.author.outputs.number }}"
192-
type="${{ steps.author.outputs.type }}"
193191
risk="${{ steps.overall.outputs.risk }}"
194192
profile="${{ steps.results.outputs.profile }}"
195193
cred="${{ steps.results.outputs.credential }}"
194+
marker="<!-- agt-contributor-check -->"
195+
comment_id=$(
196+
gh api "repos/${{ github.repository }}/issues/$number/comments" --paginate \
197+
--arg marker "$marker" \
198+
--jq '.[] | select(.user.login == "github-actions[bot]" and (.body | contains($marker))) | .id' \
199+
| head -n 1
200+
)
201+
202+
if [ "$risk" != "MEDIUM" ] && [ "$risk" != "HIGH" ]; then
203+
if [ -n "$comment_id" ]; then
204+
gh api --method DELETE "repos/${{ github.repository }}/issues/comments/$comment_id" \
205+
|| echo "Comment $comment_id could not be deleted; continuing because the comment may have already been removed or changed."
206+
fi
207+
exit 0
208+
fi
196209
197210
if [ "$risk" = "HIGH" ]; then icon="🔴"; else icon="🟡"; fi
198211
199212
body=$(cat <<EOF
200-
<!-- agt-contributor-check -->
213+
$marker
201214
$icon **Contributor Reputation Check: $risk risk**
202215
203216
| Check | Risk |
@@ -211,30 +224,35 @@ jobs:
211224
EOF
212225
)
213226
214-
if [ "$type" = "pr" ]; then
215-
gh pr comment "$number" --body "$body"
227+
if [ -n "$comment_id" ]; then
228+
gh api --method PATCH "repos/${{ github.repository }}/issues/comments/$comment_id" -f body="$body"
216229
else
217-
gh issue comment "$number" --body "$body"
230+
gh api --method POST "repos/${{ github.repository }}/issues/$number/comments" -f body="$body"
218231
fi
219232
220-
- name: Add risk label
221-
if: steps.overall.outputs.risk == 'MEDIUM' || steps.overall.outputs.risk == 'HIGH'
233+
- name: Sync risk label
222234
env:
223235
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224236
run: |
225237
number="${{ steps.author.outputs.number }}"
226-
type="${{ steps.author.outputs.type }}"
227238
risk="${{ steps.overall.outputs.risk }}"
228239
240+
for label in needs-review:MEDIUM needs-review:HIGH; do
241+
if [ "$label" != "needs-review:$risk" ]; then
242+
gh api --method DELETE "repos/${{ github.repository }}/issues/$number/labels/$label" >/dev/null 2>&1 || true
243+
fi
244+
done
245+
246+
if [ "$risk" != "MEDIUM" ] && [ "$risk" != "HIGH" ]; then
247+
exit 0
248+
fi
249+
229250
gh label create "needs-review:$risk" \
230251
--description "Contributor reputation check flagged $risk risk" \
231252
--color "FFA500" --force 2>/dev/null || true
232253
233-
if [ "$type" = "pr" ]; then
234-
gh pr edit "$number" --add-label "needs-review:$risk"
235-
else
236-
gh issue edit "$number" --add-label "needs-review:$risk"
237-
fi
254+
gh api --method POST "repos/${{ github.repository }}/issues/$number/labels" \
255+
-f labels[]="needs-review:$risk" >/dev/null
238256
239257
- name: Job summary
240258
if: always()

docs/README.instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-instructions) for guidelines on
3737
| [Azure Functions Typescript](../instructions/azure-functions-typescript.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-functions-typescript.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-functions-typescript.instructions.md) | TypeScript patterns for Azure Functions |
3838
| [Azure Iot Edge Architecture](../instructions/azure-iot-edge-architecture.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-iot-edge-architecture.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-iot-edge-architecture.instructions.md) | Require Azure IoT Edge documentation review before proposing edge IoT architectures or Azure implementation guidance. |
3939
| [Azure Logic Apps and Power Automate Instructions](../instructions/azure-logic-apps-power-automate.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-logic-apps-power-automate.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-logic-apps-power-automate.instructions.md) | Guidelines for developing Azure Logic Apps and Power Automate workflows with best practices for Workflow Definition Language (WDL), integration patterns, and enterprise automation |
40+
| [Azure Resource Naming Conventions (CAF)](../instructions/azure-naming.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-naming.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-naming.instructions.md) | Azure resource naming conventions based on Microsoft CAF (Cloud Adoption Framework). Use when creating, reviewing, or suggesting names for Azure resources. |
4041
| [Azure Terraform Best Practices](../instructions/terraform-azure.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fterraform-azure.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fterraform-azure.instructions.md) | Create or modify solutions built using Terraform on Azure. |
4142
| [Azure Verified Modules (AVM) Bicep](../instructions/azure-verified-modules-bicep.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-verified-modules-bicep.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-verified-modules-bicep.instructions.md) | Azure Verified Modules (AVM) and Bicep |
4243
| [Azure Verified Modules (AVM) Terraform](../instructions/azure-verified-modules-terraform.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-verified-modules-terraform.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-verified-modules-terraform.instructions.md) | Azure Verified Modules (AVM) and Terraform |

0 commit comments

Comments
 (0)