Skip to content

Commit 47a341f

Browse files
heftymouseyaira2
authored andcommitted
add environment, change messages
1 parent 235b8d4 commit 47a341f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/format-xaml.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
shell: pwsh
1414
permissions:
1515
contents: write
16+
environment: Pull Requests
1617

1718
steps:
1819
- name: Generate GitHub Apps token
@@ -37,7 +38,7 @@ jobs:
3738
run: |
3839
if (!(gh pr -R ${{ github.repository }} view ${{ github.event.issue.number }} --json maintainerCanModify -q '.maintainerCanModify' | ConvertFrom-Json))
3940
{
40-
gh pr comment ${{ github.event.issue.number }} -b "This PR cannot be committed to. Ensure that Allow edits from maintainers is enabled."
41+
gh pr comment ${{ github.event.issue.number }} -b "🔒 This PR cannot be committed to. Ensure that Allow edits from maintainers is enabled."
4142
"CAN_RUN=0" | Out-File -FilePath $env:GITHUB_ENV -Append
4243
}
4344
@@ -70,7 +71,7 @@ jobs:
7071
$changedFiles = (git diff --name-only pr..$baseRef) -split "\n" | Where-Object {$_ -like "*.xaml"}
7172
if ($changedFiles.Count -eq 0)
7273
{
73-
gh pr comment ${{ github.event.issue.number }} -b "No XAML files found to format."
74+
gh pr comment ${{ github.event.issue.number }} -b "No XAML files found to format."
7475
"CAN_RUN=0" | Out-File -FilePath $env:GITHUB_ENV -Append
7576
}
7677
@@ -89,7 +90,7 @@ jobs:
8990
git status --porcelain
9091
if ((git status --porcelain) -eq $null)
9192
{
92-
gh pr comment ${{ github.event.issue.number }} -b "No XAML files changed."
93+
gh pr comment ${{ github.event.issue.number }} -b "No XAML files changed."
9394
"CAN_RUN=0" | Out-File -FilePath $env:GITHUB_ENV -Append
9495
}
9596
else
@@ -127,7 +128,7 @@ jobs:
127128
128129
if ($LASTEXITCODE -eq 0)
129130
{
130-
gh pr comment ${{ github.event.issue.number }} -b "Successfully formatted XAML files."
131+
gh pr comment ${{ github.event.issue.number }} -b "Successfully formatted XAML files."
131132
}
132133
else
133134
{
@@ -136,5 +137,5 @@ jobs:
136137
continue-on-error: true
137138

138139
- name: Comment if failed
139-
if: failure() && env.CAN_RUN == 1
140-
run: gh pr comment ${{ github.event.issue.number }} -b "Failed to format XAML files, check logs for more information."
140+
if: failure() && env.CAN_RUN == 0
141+
run: gh pr comment ${{ github.event.issue.number }} -b "⚠️ Failed to format XAML files, check [the logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more information."

0 commit comments

Comments
 (0)