Skip to content

Commit 8f91034

Browse files
authored
add environment, change messages
1 parent 34f453a commit 8f91034

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
@@ -12,6 +12,7 @@ jobs:
1212
shell: pwsh
1313
permissions:
1414
contents: write
15+
environment: Pull Requests
1516

1617
steps:
1718
- name: Generate GitHub Apps token
@@ -36,7 +37,7 @@ jobs:
3637
run: |
3738
if (!(gh pr -R ${{ github.repository }} view ${{ github.event.issue.number }} --json maintainerCanModify -q '.maintainerCanModify' | ConvertFrom-Json))
3839
{
39-
gh pr comment ${{ github.event.issue.number }} -b "This PR cannot be committed to. Ensure that Allow edits from maintainers is enabled."
40+
gh pr comment ${{ github.event.issue.number }} -b "🔒 This PR cannot be committed to. Ensure that Allow edits from maintainers is enabled."
4041
"CAN_RUN=0" | Out-File -FilePath $env:GITHUB_ENV -Append
4142
}
4243
@@ -69,7 +70,7 @@ jobs:
6970
$changedFiles = (git diff --name-only pr..$baseRef) -split "\n" | Where-Object {$_ -like "*.xaml"}
7071
if ($changedFiles.Count -eq 0)
7172
{
72-
gh pr comment ${{ github.event.issue.number }} -b "No XAML files found to format."
73+
gh pr comment ${{ github.event.issue.number }} -b "No XAML files found to format."
7374
"CAN_RUN=0" | Out-File -FilePath $env:GITHUB_ENV -Append
7475
}
7576
@@ -88,7 +89,7 @@ jobs:
8889
git status --porcelain
8990
if ((git status --porcelain) -eq $null)
9091
{
91-
gh pr comment ${{ github.event.issue.number }} -b "No XAML files changed."
92+
gh pr comment ${{ github.event.issue.number }} -b "No XAML files changed."
9293
"CAN_RUN=0" | Out-File -FilePath $env:GITHUB_ENV -Append
9394
}
9495
else
@@ -126,7 +127,7 @@ jobs:
126127
127128
if ($LASTEXITCODE -eq 0)
128129
{
129-
gh pr comment ${{ github.event.issue.number }} -b "Successfully formatted XAML files."
130+
gh pr comment ${{ github.event.issue.number }} -b "Successfully formatted XAML files."
130131
}
131132
else
132133
{
@@ -135,5 +136,5 @@ jobs:
135136
continue-on-error: true
136137

137138
- name: Comment if failed
138-
if: failure() && env.CAN_RUN == 1
139-
run: gh pr comment ${{ github.event.issue.number }} -b "Failed to format XAML files, check logs for more information."
139+
if: failure() && env.CAN_RUN == 0
140+
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)