Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Using github cli
  • Loading branch information
aaronpowell committed Sep 2, 2025
commit b5e54df22c4d4f8bcf17e9e610b8ec334480b45b
23 changes: 8 additions & 15 deletions .github/workflows/dotnet-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,23 @@ jobs:
# Change this label name to whatever you use to skip publishing.
SKIP_PUBLISH_LABEL: skip-nuget-publish
steps:
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing step name before the id field. GitHub Actions requires a name field or the step will use a default name. Add - name: Check for skip label before the id field.

Note: See the diff below for a potential fix:

@@ -164,6 +164,7 @@
       # Change this label name to whatever you use to skip publishing.
       SKIP_PUBLISH_LABEL: skip-nuget-publish
     steps:
+        name: Check for skip label
         id: check
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copilot uses AI. Check for mistakes.
- name: Get PRs for commit
id: get_prs
run: |
prs=$(curl -s -H "Accept: application/vnd.github.groot-preview+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls")
echo "$prs" > prs.json

- name: Determine skip label
- name: Determine skip label using gh
id: check
run: |
LABEL="${SKIP_PUBLISH_LABEL}"
number=$(jq -r '.[0].number // empty' prs.json)
if [ -z "$number" ]; then
# Get the first PR associated with this commit (if any)
number=$(gh api -H "Accept: application/vnd.github.groot-preview+json" \
"/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" --jq '.[0].number' 2>/dev/null || echo "")
if [ -z "$number" ] || [ "$number" = "null" ]; then
# No PR found for this commit -> do not skip by default
echo "skip=false" >> $GITHUB_OUTPUT
exit 0
fi
pr=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls/$number")
echo "$pr" > pr.json
has_label=$(jq -r --arg label "$LABEL" '.labels[].name | select(. == $label) // empty' pr.json)

# List label names for the PR and check for an exact match
has_label=$(gh api "/repos/${{ github.repository }}/pulls/$number" --jq '.labels[].name' 2>/dev/null | grep -x -- "$LABEL" || true)
if [ -n "$has_label" ]; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi

Loading