Skip to content
Draft
Show file tree
Hide file tree
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
Enhance workflows: structured logging, retry logic, concurrency controls
Co-authored-by: marilene38 <135267736+marilene38@users.noreply.github.com>
  • Loading branch information
Copilot and marilene38 committed Feb 24, 2026
commit 65ea31136b79796ba2437706dae1dd70b72ae4e5
55 changes: 51 additions & 4 deletions .github/workflows/auto-close-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ jobs:
name: Close fork PRs with guidance
runs-on: ubuntu-latest
steps:
- name: Log PR details
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
PR_STATE: ${{ github.event.pull_request.state }}
EVENT_ACTION: ${{ github.event.action }}
run: |
echo "::group::PR Details"
echo "PR number: $PR_NUMBER"
echo "PR author: $PR_AUTHOR"
echo "Head repo: $PR_HEAD_REPO"
echo "PR state: $PR_STATE"
echo "Event action: $EVENT_ACTION"
echo "::endgroup::"

- name: Close PR from fork with message
if: >-
github.event.pull_request.head.repo.full_name != github.repository &&
Expand All @@ -26,12 +42,43 @@ jobs:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
gh pr close "$PR_NUMBER" \
--reason not_planned \
--comment "$(cat <<'EOF'
MAX_RETRIES=3
BACKOFF_SECONDS=5
echo "::notice::Closing fork PR #$PR_NUMBER"
for attempt in $(seq 1 $MAX_RETRIES); do
if gh pr close "$PR_NUMBER" \
--reason not_planned \
--comment "$(cat <<'EOF'
Thanks for the pull request! At the moment we are not accepting contributions to this repository.

Feedback for GitHub Copilot for Xcode can be shared in the Copilot community discussions:
https://github.com/orgs/community/discussions/categories/copilot
EOF
)"
)"; then
echo "::notice::Successfully closed PR #$PR_NUMBER on attempt $attempt"
break
else
echo "::warning::Attempt $attempt to close PR #$PR_NUMBER failed"
if [ "$attempt" -lt "$MAX_RETRIES" ]; then
sleep $((attempt * BACKOFF_SECONDS))
else
echo "::error::Failed to close PR #$PR_NUMBER after $attempt attempts"
exit 1
fi
fi
done

- name: Log skip reason
if: >-
github.event.pull_request.head.repo.full_name == github.repository ||
github.event.pull_request.state != 'open'
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
PR_STATE: ${{ github.event.pull_request.state }}
run: |
if [ "$PR_HEAD_REPO" = "$GITHUB_REPOSITORY" ]; then
echo "::notice::Skipping PR #$PR_NUMBER: opened from the same repository"
else
echo "::notice::Skipping PR #$PR_NUMBER: PR state is '$PR_STATE' (not open)"
fi
20 changes: 20 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
schedule:
- cron: '24 23 * * 1'

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
analyze:
name: Analyze (${{ matrix.language }})
Expand Down Expand Up @@ -35,6 +39,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log analysis start
env:
LANGUAGE: ${{ matrix.language }}
BUILD_MODE: ${{ matrix.build-mode }}
REF: ${{ github.ref }}
EVENT: ${{ github.event_name }}
run: |
echo "::group::CodeQL Analysis Details"
echo "Language: $LANGUAGE"
echo "Build mode: $BUILD_MODE"
echo "Ref: $REF"
echo "Event: $EVENT"
echo "::endgroup::"

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand All @@ -54,6 +72,7 @@ jobs:
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo "::group::Build"
xcodebuild \
-scheme 'Copilot for Xcode' \
-quiet \
Expand All @@ -64,6 +83,7 @@ jobs:
-workspace 'Copilot for Xcode.xcworkspace' \
archive \
CODE_SIGNING_ALLOWED="NO"
echo "::endgroup::"

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down