From 245840541b74d49551697a1e9757e5029ebd764e Mon Sep 17 00:00:00 2001 From: Dan Wahlin Date: Sun, 4 Oct 2026 23:50:04 -0700 Subject: [PATCH 1/4] Fix authenticated course update checks --- .github/workflows/course-updater.lock.yml | 205 ++++++++++++++++++++-- .github/workflows/course-updater.md | 69 +++++++- 2 files changed, 249 insertions(+), 25 deletions(-) diff --git a/.github/workflows/course-updater.lock.yml b/.github/workflows/course-updater.lock.yml index 52c079b..e0b9225 100644 --- a/.github/workflows/course-updater.lock.yml +++ b/.github/workflows/course-updater.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"a8031db3ba84823d0bceb239d4d708ce7d4814a446059dcab07251955e0eb901","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"f058adb64aaf9184f02a68d16c51d72ac93c1e2f6b8e9df1965bf0a01f7a4786","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9"},{"repo":"actions/upload-artifact","sha":"bbbca2ddaa5d8feaa63e36b76fdaad77386f024f","version":"v7"},{"repo":"github/gh-aw-actions/setup","sha":"2fe53acc038ba01c3bbdc767d4b25df31ca5bdfc","version":"v0.68.1"}]} # ___ _ _ # / _ \ | | (_) @@ -158,19 +158,19 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_60309d17794877ae_EOF' + cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' - GH_AW_PROMPT_60309d17794877ae_EOF + GH_AW_PROMPT_4e49f319e360c9be_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_60309d17794877ae_EOF' + cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' Tools: create_pull_request, missing_tool, missing_data, noop - GH_AW_PROMPT_60309d17794877ae_EOF + GH_AW_PROMPT_4e49f319e360c9be_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_create_pull_request.md" - cat << 'GH_AW_PROMPT_60309d17794877ae_EOF' + cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' The following GitHub context information is available for this workflow: @@ -200,12 +200,12 @@ jobs: {{/if}} - GH_AW_PROMPT_60309d17794877ae_EOF + GH_AW_PROMPT_4e49f319e360c9be_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_60309d17794877ae_EOF' + cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' {{#runtime-import .github/workflows/course-updater.md}} - GH_AW_PROMPT_60309d17794877ae_EOF + GH_AW_PROMPT_4e49f319e360c9be_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 @@ -369,9 +369,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_3aad4d6eae9cb6dd_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_1a3a291e197dff5b_EOF' {"create_pull_request":{"base_branch":"main","labels":["automated-update","copilot-app-updates"],"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS"],"protected_path_prefixes":[".github/",".agents/"],"title_prefix":"[bot] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_3aad4d6eae9cb6dd_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_1a3a291e197dff5b_EOF - name: Write Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -541,12 +541,150 @@ jobs: bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh" + - name: Write MCP Scripts Config + run: | + mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs" + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/tools.json" << 'GH_AW_MCP_SCRIPTS_TOOLS_11ced51cf9b565b8_EOF' + { + "serverName": "mcpscripts", + "version": "1.0.0", + "logDir": "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs", + "tools": [ + { + "name": "fetch-app-updates", + "description": "Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days.", + "inputSchema": { + "properties": {}, + "type": "object" + }, + "handler": "fetch-app-updates.sh", + "env": { + "GH_TOKEN": "GH_TOKEN" + }, + "timeout": 60 + }, + { + "name": "fetch-open-update-prs", + "description": "Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs.", + "inputSchema": { + "properties": {}, + "type": "object" + }, + "handler": "fetch-open-update-prs.sh", + "env": { + "GH_TOKEN": "GH_TOKEN" + }, + "timeout": 60 + } + ] + } + GH_AW_MCP_SCRIPTS_TOOLS_11ced51cf9b565b8_EOF + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" << 'GH_AW_MCP_SCRIPTS_SERVER_5c6b471ab0e7493e_EOF' + const path = require("path"); + const { startHttpServer } = require("./mcp_scripts_mcp_server_http.cjs"); + const configPath = path.join(__dirname, "tools.json"); + const port = parseInt(process.env.GH_AW_MCP_SCRIPTS_PORT || "3000", 10); + const apiKey = process.env.GH_AW_MCP_SCRIPTS_API_KEY || ""; + startHttpServer(configPath, { + port: port, + stateless: true, + logDir: "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs" + }).catch(error => { + console.error("Failed to start mcp-scripts HTTP server:", error); + process.exit(1); + }); + GH_AW_MCP_SCRIPTS_SERVER_5c6b471ab0e7493e_EOF + chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" + + - name: Write MCP Scripts Tool Files + run: | + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_5d30c9738f749402_EOF' + #!/bin/bash + # Auto-generated mcp-script tool: fetch-app-updates + # Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days. + + set -euo pipefail + + set -euo pipefail + since="$(node -p 'new Date(Date.now() - 7 * 86400000).toISOString().replace(/\.\d{3}Z$/, "Z")')" + releases="$(gh api --paginate --slurp 'repos/github/app/releases?per_page=100' | + jq --arg since "$since" '[.[][] | select(.published_at != null and .published_at >= $since) | {tag_name, published_at, html_url, body}]')" + tags="$(printf '%s' "$releases" | jq 'map(.tag_name)')" + printf '%s\n' '## Changelog: https://github.com/github/app/blob/main/changelog.md' + gh api 'repos/github/app/contents/changelog.md?ref=main' --jq '.content | @base64d' | + jq -Rrs --argjson tags "$tags" ' + [split("\n## ")[] | select(split("\n")[0] as $tag | $tags | index($tag)) | "## " + .] as $sections | + if ($sections | length) != ($tags | length) then + error("Missing changelog sections for recent releases") + else + $sections | join("\n") + end' + printf '\n## Releases since %s\n' "$since" + printf '%s\n' "$releases" + printf '\n## Commits since %s\n' "$since" + gh api --paginate --slurp "repos/github/app/commits?since=$since&per_page=100" | + jq '[.[][] | {sha, html_url, message: .commit.message, date: .commit.committer.date}]' + + + GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_5d30c9738f749402_EOF + chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_95daf0073e6831ca_EOF' + #!/bin/bash + # Auto-generated mcp-script tool: fetch-open-update-prs + # Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs. + + set -euo pipefail + + set -euo pipefail + gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/pulls?state=open&per_page=100" | + jq '[.[][] | select(any(.labels[]; .name == "automated-update" or .name == "copilot-app-updates")) | {number, title, body, html_url}]' + + + GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_95daf0073e6831ca_EOF + chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" + + - name: Generate MCP Scripts Server Config + id: mcp-scripts-config + run: | + # Generate a secure random API key (360 bits of entropy, 40+ chars) + # Mask immediately to prevent timing vulnerabilities + API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${API_KEY}" + + PORT=3000 + + # Set outputs for next steps + { + echo "mcp_scripts_api_key=${API_KEY}" + echo "mcp_scripts_port=${PORT}" + } >> "$GITHUB_OUTPUT" + + echo "MCP Scripts server will run on port ${PORT}" + + - name: Start MCP Scripts HTTP Server + id: mcp-scripts-start + env: + DEBUG: '*' + GH_AW_MCP_SCRIPTS_PORT: ${{ steps.mcp-scripts-config.outputs.mcp_scripts_port }} + GH_AW_MCP_SCRIPTS_API_KEY: ${{ steps.mcp-scripts-config.outputs.mcp_scripts_api_key }} + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + run: | + # Environment variables are set above to prevent template injection + export DEBUG + export GH_AW_MCP_SCRIPTS_PORT + export GH_AW_MCP_SCRIPTS_API_KEY + + bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_scripts_server.sh" + - name: Start MCP Gateway id: start-mcp-gateway env: + GH_AW_MCP_SCRIPTS_API_KEY: ${{ steps.mcp-scripts-start.outputs.api_key }} + GH_AW_MCP_SCRIPTS_PORT: ${{ steps.mcp-scripts-start.outputs.port }} GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }} GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }} + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} GITHUB_MCP_GUARD_MIN_INTEGRITY: ${{ steps.determine-automatic-lockdown.outputs.min_integrity }} GITHUB_MCP_GUARD_REPOS: ${{ steps.determine-automatic-lockdown.outputs.repos }} GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} @@ -566,10 +704,10 @@ jobs: export DEBUG="*" export GH_AW_ENGINE="copilot" - export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.17' + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_MCP_SCRIPTS_PORT -e GH_AW_MCP_SCRIPTS_API_KEY -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -e GH_TOKEN -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.17' mkdir -p /home/runner/.copilot - cat << GH_AW_MCP_CONFIG_8234c3d86b8db8c5_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" + cat << GH_AW_MCP_CONFIG_8d09a77e58d6514d_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" { "mcpServers": { "github": { @@ -588,6 +726,20 @@ jobs: } } }, + "mcpscripts": { + "type": "http", + "url": "http://host.docker.internal:$GH_AW_MCP_SCRIPTS_PORT", + "headers": { + "Authorization": "\${GH_AW_MCP_SCRIPTS_API_KEY}" + }, + "guard-policies": { + "write-sink": { + "accept": [ + "*" + ] + } + } + }, "safeoutputs": { "type": "http", "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", @@ -610,7 +762,7 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_8234c3d86b8db8c5_EOF + GH_AW_MCP_CONFIG_8d09a77e58d6514d_EOF - name: Download activation artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -623,12 +775,11 @@ jobs: id: agentic_execution # Copilot CLI tool arguments (sorted): # --allow-tool github + # --allow-tool mcpscripts # --allow-tool safeoutputs # --allow-tool shell(cat) - # --allow-tool shell(curl:*) # --allow-tool shell(date) # --allow-tool shell(echo) - # --allow-tool shell(gh:*) # --allow-tool shell(git add:*) # --allow-tool shell(git branch:*) # --allow-tool shell(git checkout:*) @@ -646,7 +797,6 @@ jobs: # --allow-tool shell(uniq) # --allow-tool shell(wc) # --allow-tool shell(yq) - # --allow-tool web_fetch # --allow-tool write timeout-minutes: 20 run: | @@ -654,8 +804,8 @@ jobs: touch /tmp/gh-aw/agent-step-summary.md (umask 177 && touch /tmp/gh-aw/agent-stdio.log) # shellcheck disable=SC1003 - sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(curl:*)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(gh:*)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool web_fetch --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ + -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool mcpscripts --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} @@ -665,6 +815,7 @@ jobs: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} GH_AW_VERSION: v0.68.1 + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} GITHUB_API_URL: ${{ github.api_url }} GITHUB_AW: true GITHUB_HEAD_REF: ${{ github.head_ref }} @@ -760,6 +911,15 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs'); await main(); + - name: Parse MCP Scripts logs for step summary + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_scripts_logs.cjs'); + await main(); - name: Parse MCP Gateway logs for step summary if: always() id: parse-mcp-gateway @@ -801,6 +961,12 @@ jobs: if [ ! -f /tmp/gh-aw/agent_output.json ]; then echo '{"items":[]}' > /tmp/gh-aw/agent_output.json fi + - env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + if: always() + name: Require a complete course update check + run: "node <<'NODE'\nconst { readFileSync } = require('node:fs');\nconst outputPath = process.env.GH_AW_SAFE_OUTPUTS;\nif (!outputPath) {\n throw new Error('The course update output path is missing.');\n}\nconst outputs = readFileSync(outputPath, 'utf8')\n .split(/\\r?\\n/)\n .filter(line => line.trim())\n .map(line => JSON.parse(line));\nconst completeTypes = new Set(['create_pull_request', 'noop']);\nif (!outputs.length || outputs.some(output => !completeTypes.has(output.type))) {\n const types = outputs.map(output => output.type).join(', ') || 'no output';\n throw new Error(`Course update check is incomplete (${types}). See the agent logs.`);\n}\nNODE\n" + - name: Upload agent artifacts if: always() continue-on-error: true @@ -812,6 +978,7 @@ jobs: /tmp/gh-aw/sandbox/agent/logs/ /tmp/gh-aw/redacted-urls.log /tmp/gh-aw/mcp-logs/ + /tmp/gh-aw/mcp-scripts/logs/ /tmp/gh-aw/agent_usage.json /tmp/gh-aw/agent-stdio.log /tmp/gh-aw/agent/ diff --git a/.github/workflows/course-updater.md b/.github/workflows/course-updater.md index a5994bb..8d3c4fa 100644 --- a/.github/workflows/course-updater.md +++ b/.github/workflows/course-updater.md @@ -5,11 +5,65 @@ on: schedule: weekly on monday workflow_dispatch: tools: - bash: ["curl", "gh"] + bash: ["date"] edit: - web-fetch: github: toolsets: [repos] +mcp-scripts: + fetch-app-updates: + description: "Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days." + run: | + set -euo pipefail + since="$(node -p 'new Date(Date.now() - 7 * 86400000).toISOString().replace(/\.\d{3}Z$/, "Z")')" + releases="$(gh api --paginate --slurp 'repos/github/app/releases?per_page=100' | + jq --arg since "$since" '[.[][] | select(.published_at != null and .published_at >= $since) | {tag_name, published_at, html_url, body}]')" + tags="$(printf '%s' "$releases" | jq 'map(.tag_name)')" + printf '%s\n' '## Changelog: https://github.com/github/app/blob/main/changelog.md' + gh api 'repos/github/app/contents/changelog.md?ref=main' --jq '.content | @base64d' | + jq -Rrs --argjson tags "$tags" ' + [split("\n## ")[] | select(split("\n")[0] as $tag | $tags | index($tag)) | "## " + .] as $sections | + if ($sections | length) != ($tags | length) then + error("Missing changelog sections for recent releases") + else + $sections | join("\n") + end' + printf '\n## Releases since %s\n' "$since" + printf '%s\n' "$releases" + printf '\n## Commits since %s\n' "$since" + gh api --paginate --slurp "repos/github/app/commits?since=$since&per_page=100" | + jq '[.[][] | {sha, html_url, message: .commit.message, date: .commit.committer.date}]' + env: + GH_TOKEN: "${{ secrets.GH_AW_GITHUB_TOKEN }}" + fetch-open-update-prs: + description: "Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs." + run: | + set -euo pipefail + gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/pulls?state=open&per_page=100" | + jq '[.[][] | select(any(.labels[]; .name == "automated-update" or .name == "copilot-app-updates")) | {number, title, body, html_url}]' + env: + GH_TOKEN: "${{ secrets.GH_AW_GITHUB_TOKEN }}" +post-steps: + - name: Require a complete course update check + if: always() + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + run: | + node <<'NODE' + const { readFileSync } = require('node:fs'); + const outputPath = process.env.GH_AW_SAFE_OUTPUTS; + if (!outputPath) { + throw new Error('The course update output path is missing.'); + } + const outputs = readFileSync(outputPath, 'utf8') + .split(/\r?\n/) + .filter(line => line.trim()) + .map(line => JSON.parse(line)); + const completeTypes = new Set(['create_pull_request', 'noop']); + if (!outputs.length || outputs.some(output => !completeTypes.has(output.type))) { + const types = outputs.map(output => output.type).join(', ') || 'no output'; + throw new Error(`Course update check is incomplete (${types}). See the agent logs.`); + } + NODE safe-outputs: allowed-domains: - github.com @@ -25,11 +79,14 @@ You are a documentation maintainer for the Copilot App for Beginners repository. ## Step 1 — Gather recent Copilot app updates -Use `web-fetch` to read the following pages and extract the latest entries from the past 7 days: +Call `fetch-app-updates` (no inputs needed). This authenticated tool reads: - https://github.com/github/app/blob/main/changelog.md — GitHub Copilot app changelog +- Releases and commits in `github/app` from the past 7 days -Also use `gh` CLI to check the latest releases and commits in the `github/app` repo. +Use the returned changelog, release notes, and commit details to identify updates from the past 7 days. Do not use `web-fetch`, `curl`, or shell `gh` commands for these checks. + +If this tool or `fetch-open-update-prs` fails, report the error with `missing_data` or `missing_tool` and stop. Do not assume that a source repository is private, report that no updates are needed, or edit course content without the required source data. An incomplete check must fail the workflow. Look for: @@ -39,7 +96,7 @@ Look for: ## Step 2 — Check for existing open PRs to avoid duplicates -Before doing any content comparison, list all open pull requests in this repo that have the `automated-update` or `copilot-app-updates` labels. Read their titles and descriptions to understand which features or changes each PR already covers. Build a list of features that are **already addressed** by existing PRs — you must exclude those features from any updates you propose later. If every feature you found in Step 1 is already covered by an open PR, stop here and report that no new updates are needed. +Before doing any content comparison, call `fetch-open-update-prs` (no inputs needed). It returns all open pull requests in this repo that have the `automated-update` or `copilot-app-updates` labels. Read their titles and descriptions to understand which features or changes each PR already covers. Build a list of features that are **already addressed** by existing PRs — you must exclude those features from any updates you propose later. If every feature you found in Step 1 is already covered by an open PR, stop here and call `noop` to report that no new updates are needed. ## Step 3 — Compare against the current course content @@ -51,7 +108,7 @@ Identify: - **Missing features** — new capabilities not yet documented - **Outdated information** — features that have been renamed, moved, or significantly changed (including UI labels, menu names, or button text shown in screenshots) -If there is nothing new or everything is already up to date, stop here and report that no updates are needed. +If there is nothing new or everything is already up to date, stop here and call `noop` to report that no updates are needed. ## Step 4 — Update the course content From 6c47725033a4f945992877d76e109dd34454894d Mon Sep 17 00:00:00 2001 From: Dan Wahlin Date: Mon, 5 Oct 2026 00:00:25 -0700 Subject: [PATCH 2/4] Allow reading large Course Updater tool results --- .github/workflows/course-updater.lock.yml | 45 ++++++++++++----------- .github/workflows/course-updater.md | 6 ++- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/.github/workflows/course-updater.lock.yml b/.github/workflows/course-updater.lock.yml index e0b9225..c554caa 100644 --- a/.github/workflows/course-updater.lock.yml +++ b/.github/workflows/course-updater.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"f058adb64aaf9184f02a68d16c51d72ac93c1e2f6b8e9df1965bf0a01f7a4786","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"0fc9bf7dad4b36671e1bea6ffa7ee0a44489fd28f3fc48bdfc1209409dc91279","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9"},{"repo":"actions/upload-artifact","sha":"bbbca2ddaa5d8feaa63e36b76fdaad77386f024f","version":"v7"},{"repo":"github/gh-aw-actions/setup","sha":"2fe53acc038ba01c3bbdc767d4b25df31ca5bdfc","version":"v0.68.1"}]} # ___ _ _ # / _ \ | | (_) @@ -158,19 +158,19 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' + cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' - GH_AW_PROMPT_4e49f319e360c9be_EOF + GH_AW_PROMPT_8523d14472a72367_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' + cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' Tools: create_pull_request, missing_tool, missing_data, noop - GH_AW_PROMPT_4e49f319e360c9be_EOF + GH_AW_PROMPT_8523d14472a72367_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_create_pull_request.md" - cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' + cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' The following GitHub context information is available for this workflow: @@ -200,12 +200,12 @@ jobs: {{/if}} - GH_AW_PROMPT_4e49f319e360c9be_EOF + GH_AW_PROMPT_8523d14472a72367_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_4e49f319e360c9be_EOF' + cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' {{#runtime-import .github/workflows/course-updater.md}} - GH_AW_PROMPT_4e49f319e360c9be_EOF + GH_AW_PROMPT_8523d14472a72367_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 @@ -369,9 +369,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_1a3a291e197dff5b_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_3e670196f63c3f3c_EOF' {"create_pull_request":{"base_branch":"main","labels":["automated-update","copilot-app-updates"],"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS"],"protected_path_prefixes":[".github/",".agents/"],"title_prefix":"[bot] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_1a3a291e197dff5b_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_3e670196f63c3f3c_EOF - name: Write Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -544,7 +544,7 @@ jobs: - name: Write MCP Scripts Config run: | mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs" - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/tools.json" << 'GH_AW_MCP_SCRIPTS_TOOLS_11ced51cf9b565b8_EOF' + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/tools.json" << 'GH_AW_MCP_SCRIPTS_TOOLS_eb072c233d26e6af_EOF' { "serverName": "mcpscripts", "version": "1.0.0", @@ -578,8 +578,8 @@ jobs: } ] } - GH_AW_MCP_SCRIPTS_TOOLS_11ced51cf9b565b8_EOF - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" << 'GH_AW_MCP_SCRIPTS_SERVER_5c6b471ab0e7493e_EOF' + GH_AW_MCP_SCRIPTS_TOOLS_eb072c233d26e6af_EOF + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" << 'GH_AW_MCP_SCRIPTS_SERVER_608630aad76b7c20_EOF' const path = require("path"); const { startHttpServer } = require("./mcp_scripts_mcp_server_http.cjs"); const configPath = path.join(__dirname, "tools.json"); @@ -593,12 +593,12 @@ jobs: console.error("Failed to start mcp-scripts HTTP server:", error); process.exit(1); }); - GH_AW_MCP_SCRIPTS_SERVER_5c6b471ab0e7493e_EOF + GH_AW_MCP_SCRIPTS_SERVER_608630aad76b7c20_EOF chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" - name: Write MCP Scripts Tool Files run: | - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_5d30c9738f749402_EOF' + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_f18b587dc869f149_EOF' #!/bin/bash # Auto-generated mcp-script tool: fetch-app-updates # Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days. @@ -626,9 +626,9 @@ jobs: jq '[.[][] | {sha, html_url, message: .commit.message, date: .commit.committer.date}]' - GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_5d30c9738f749402_EOF + GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_f18b587dc869f149_EOF chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_95daf0073e6831ca_EOF' + cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_1e52298d7362c0d1_EOF' #!/bin/bash # Auto-generated mcp-script tool: fetch-open-update-prs # Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs. @@ -640,7 +640,7 @@ jobs: jq '[.[][] | select(any(.labels[]; .name == "automated-update" or .name == "copilot-app-updates")) | {number, title, body, html_url}]' - GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_95daf0073e6831ca_EOF + GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_1e52298d7362c0d1_EOF chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" - name: Generate MCP Scripts Server Config @@ -707,7 +707,7 @@ jobs: export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_MCP_SCRIPTS_PORT -e GH_AW_MCP_SCRIPTS_API_KEY -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -e GH_TOKEN -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.17' mkdir -p /home/runner/.copilot - cat << GH_AW_MCP_CONFIG_8d09a77e58d6514d_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" + cat << GH_AW_MCP_CONFIG_f83b5cc445e50f5f_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" { "mcpServers": { "github": { @@ -762,7 +762,7 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_8d09a77e58d6514d_EOF + GH_AW_MCP_CONFIG_f83b5cc445e50f5f_EOF - name: Download activation artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -790,6 +790,7 @@ jobs: # --allow-tool shell(git switch:*) # --allow-tool shell(grep) # --allow-tool shell(head) + # --allow-tool shell(jq) # --allow-tool shell(ls) # --allow-tool shell(pwd) # --allow-tool shell(sort) @@ -805,7 +806,7 @@ jobs: (umask 177 && touch /tmp/gh-aw/agent-stdio.log) # shellcheck disable=SC1003 sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool mcpscripts --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool mcpscripts --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(jq)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} diff --git a/.github/workflows/course-updater.md b/.github/workflows/course-updater.md index 8d3c4fa..bbe4baa 100644 --- a/.github/workflows/course-updater.md +++ b/.github/workflows/course-updater.md @@ -5,7 +5,7 @@ on: schedule: weekly on monday workflow_dispatch: tools: - bash: ["date"] + bash: ["date", "jq"] edit: github: toolsets: [repos] @@ -86,6 +86,8 @@ Call `fetch-app-updates` (no inputs needed). This authenticated tool reads: Use the returned changelog, release notes, and commit details to identify updates from the past 7 days. Do not use `web-fetch`, `curl`, or shell `gh` commands for these checks. +The tool result contains the fetched text in its `stdout` field. If a large result is saved to a file, use `jq -r '.stdout' ` to read that text. + If this tool or `fetch-open-update-prs` fails, report the error with `missing_data` or `missing_tool` and stop. Do not assume that a source repository is private, report that no updates are needed, or edit course content without the required source data. An incomplete check must fail the workflow. Look for: @@ -125,3 +127,5 @@ Create a pull request with your changes, using the `main` branch as the base bra 3. Links to the source announcements The PR should target the `main` branch and include the labels `automated-update` and `copilot-app-updates`. + +Match each feature to the version in its changelog heading and release record. Do not assign a feature to a different release. From fc70d34b378588f87e7fb3b4806bf66a02ef68e5 Mon Sep 17 00:00:00 2001 From: Dan Wahlin Date: Mon, 5 Oct 2026 00:25:55 -0700 Subject: [PATCH 3/4] Keep Course Updater aligned with the CLI workflow --- .github/workflows/course-updater.lock.yml | 203 +++------------------- .github/workflows/course-updater.md | 54 ++---- 2 files changed, 34 insertions(+), 223 deletions(-) diff --git a/.github/workflows/course-updater.lock.yml b/.github/workflows/course-updater.lock.yml index c554caa..43e6d56 100644 --- a/.github/workflows/course-updater.lock.yml +++ b/.github/workflows/course-updater.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"0fc9bf7dad4b36671e1bea6ffa7ee0a44489fd28f3fc48bdfc1209409dc91279","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"6824a20a04b2eb1964f296efab39f07df208b76edb76d21d15b64d8d03175b3d","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9"},{"repo":"actions/upload-artifact","sha":"bbbca2ddaa5d8feaa63e36b76fdaad77386f024f","version":"v7"},{"repo":"github/gh-aw-actions/setup","sha":"2fe53acc038ba01c3bbdc767d4b25df31ca5bdfc","version":"v0.68.1"}]} # ___ _ _ # / _ \ | | (_) @@ -158,19 +158,19 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' + cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' - GH_AW_PROMPT_8523d14472a72367_EOF + GH_AW_PROMPT_1ef59464ea60fd09_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' + cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' Tools: create_pull_request, missing_tool, missing_data, noop - GH_AW_PROMPT_8523d14472a72367_EOF + GH_AW_PROMPT_1ef59464ea60fd09_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_create_pull_request.md" - cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' + cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' The following GitHub context information is available for this workflow: @@ -200,12 +200,12 @@ jobs: {{/if}} - GH_AW_PROMPT_8523d14472a72367_EOF + GH_AW_PROMPT_1ef59464ea60fd09_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_8523d14472a72367_EOF' + cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' {{#runtime-import .github/workflows/course-updater.md}} - GH_AW_PROMPT_8523d14472a72367_EOF + GH_AW_PROMPT_1ef59464ea60fd09_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 @@ -277,6 +277,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + pull-requests: read concurrency: group: "gh-aw-copilot-${{ github.workflow }}" env: @@ -369,9 +370,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_3e670196f63c3f3c_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_4451e5082754bdc6_EOF' {"create_pull_request":{"base_branch":"main","labels":["automated-update","copilot-app-updates"],"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS"],"protected_path_prefixes":[".github/",".agents/"],"title_prefix":"[bot] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_3e670196f63c3f3c_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_4451e5082754bdc6_EOF - name: Write Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -541,150 +542,12 @@ jobs: bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh" - - name: Write MCP Scripts Config - run: | - mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs" - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/tools.json" << 'GH_AW_MCP_SCRIPTS_TOOLS_eb072c233d26e6af_EOF' - { - "serverName": "mcpscripts", - "version": "1.0.0", - "logDir": "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs", - "tools": [ - { - "name": "fetch-app-updates", - "description": "Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days.", - "inputSchema": { - "properties": {}, - "type": "object" - }, - "handler": "fetch-app-updates.sh", - "env": { - "GH_TOKEN": "GH_TOKEN" - }, - "timeout": 60 - }, - { - "name": "fetch-open-update-prs", - "description": "Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs.", - "inputSchema": { - "properties": {}, - "type": "object" - }, - "handler": "fetch-open-update-prs.sh", - "env": { - "GH_TOKEN": "GH_TOKEN" - }, - "timeout": 60 - } - ] - } - GH_AW_MCP_SCRIPTS_TOOLS_eb072c233d26e6af_EOF - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" << 'GH_AW_MCP_SCRIPTS_SERVER_608630aad76b7c20_EOF' - const path = require("path"); - const { startHttpServer } = require("./mcp_scripts_mcp_server_http.cjs"); - const configPath = path.join(__dirname, "tools.json"); - const port = parseInt(process.env.GH_AW_MCP_SCRIPTS_PORT || "3000", 10); - const apiKey = process.env.GH_AW_MCP_SCRIPTS_API_KEY || ""; - startHttpServer(configPath, { - port: port, - stateless: true, - logDir: "${RUNNER_TEMP}/gh-aw/mcp-scripts/logs" - }).catch(error => { - console.error("Failed to start mcp-scripts HTTP server:", error); - process.exit(1); - }); - GH_AW_MCP_SCRIPTS_SERVER_608630aad76b7c20_EOF - chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/mcp-server.cjs" - - - name: Write MCP Scripts Tool Files - run: | - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_f18b587dc869f149_EOF' - #!/bin/bash - # Auto-generated mcp-script tool: fetch-app-updates - # Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days. - - set -euo pipefail - - set -euo pipefail - since="$(node -p 'new Date(Date.now() - 7 * 86400000).toISOString().replace(/\.\d{3}Z$/, "Z")')" - releases="$(gh api --paginate --slurp 'repos/github/app/releases?per_page=100' | - jq --arg since "$since" '[.[][] | select(.published_at != null and .published_at >= $since) | {tag_name, published_at, html_url, body}]')" - tags="$(printf '%s' "$releases" | jq 'map(.tag_name)')" - printf '%s\n' '## Changelog: https://github.com/github/app/blob/main/changelog.md' - gh api 'repos/github/app/contents/changelog.md?ref=main' --jq '.content | @base64d' | - jq -Rrs --argjson tags "$tags" ' - [split("\n## ")[] | select(split("\n")[0] as $tag | $tags | index($tag)) | "## " + .] as $sections | - if ($sections | length) != ($tags | length) then - error("Missing changelog sections for recent releases") - else - $sections | join("\n") - end' - printf '\n## Releases since %s\n' "$since" - printf '%s\n' "$releases" - printf '\n## Commits since %s\n' "$since" - gh api --paginate --slurp "repos/github/app/commits?since=$since&per_page=100" | - jq '[.[][] | {sha, html_url, message: .commit.message, date: .commit.committer.date}]' - - - GH_AW_MCP_SCRIPTS_SH_FETCH-APP-UPDATES_f18b587dc869f149_EOF - chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-app-updates.sh" - cat > "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" << 'GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_1e52298d7362c0d1_EOF' - #!/bin/bash - # Auto-generated mcp-script tool: fetch-open-update-prs - # Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs. - - set -euo pipefail - - set -euo pipefail - gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/pulls?state=open&per_page=100" | - jq '[.[][] | select(any(.labels[]; .name == "automated-update" or .name == "copilot-app-updates")) | {number, title, body, html_url}]' - - - GH_AW_MCP_SCRIPTS_SH_FETCH-OPEN-UPDATE-PRS_1e52298d7362c0d1_EOF - chmod +x "${RUNNER_TEMP}/gh-aw/mcp-scripts/fetch-open-update-prs.sh" - - - name: Generate MCP Scripts Server Config - id: mcp-scripts-config - run: | - # Generate a secure random API key (360 bits of entropy, 40+ chars) - # Mask immediately to prevent timing vulnerabilities - API_KEY=$(openssl rand -base64 45 | tr -d '/+=') - echo "::add-mask::${API_KEY}" - - PORT=3000 - - # Set outputs for next steps - { - echo "mcp_scripts_api_key=${API_KEY}" - echo "mcp_scripts_port=${PORT}" - } >> "$GITHUB_OUTPUT" - - echo "MCP Scripts server will run on port ${PORT}" - - - name: Start MCP Scripts HTTP Server - id: mcp-scripts-start - env: - DEBUG: '*' - GH_AW_MCP_SCRIPTS_PORT: ${{ steps.mcp-scripts-config.outputs.mcp_scripts_port }} - GH_AW_MCP_SCRIPTS_API_KEY: ${{ steps.mcp-scripts-config.outputs.mcp_scripts_api_key }} - GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} - run: | - # Environment variables are set above to prevent template injection - export DEBUG - export GH_AW_MCP_SCRIPTS_PORT - export GH_AW_MCP_SCRIPTS_API_KEY - - bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_scripts_server.sh" - - name: Start MCP Gateway id: start-mcp-gateway env: - GH_AW_MCP_SCRIPTS_API_KEY: ${{ steps.mcp-scripts-start.outputs.api_key }} - GH_AW_MCP_SCRIPTS_PORT: ${{ steps.mcp-scripts-start.outputs.port }} GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }} GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }} - GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} GITHUB_MCP_GUARD_MIN_INTEGRITY: ${{ steps.determine-automatic-lockdown.outputs.min_integrity }} GITHUB_MCP_GUARD_REPOS: ${{ steps.determine-automatic-lockdown.outputs.repos }} GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} @@ -704,10 +567,10 @@ jobs: export DEBUG="*" export GH_AW_ENGINE="copilot" - export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_MCP_SCRIPTS_PORT -e GH_AW_MCP_SCRIPTS_API_KEY -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -e GH_TOKEN -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.17' + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.17' mkdir -p /home/runner/.copilot - cat << GH_AW_MCP_CONFIG_f83b5cc445e50f5f_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" + cat << GH_AW_MCP_CONFIG_47933e53337c2798_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" { "mcpServers": { "github": { @@ -717,7 +580,7 @@ jobs: "GITHUB_HOST": "\${GITHUB_SERVER_URL}", "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", "GITHUB_READ_ONLY": "1", - "GITHUB_TOOLSETS": "repos" + "GITHUB_TOOLSETS": "repos,pull_requests" }, "guard-policies": { "allow-only": { @@ -726,20 +589,6 @@ jobs: } } }, - "mcpscripts": { - "type": "http", - "url": "http://host.docker.internal:$GH_AW_MCP_SCRIPTS_PORT", - "headers": { - "Authorization": "\${GH_AW_MCP_SCRIPTS_API_KEY}" - }, - "guard-policies": { - "write-sink": { - "accept": [ - "*" - ] - } - } - }, "safeoutputs": { "type": "http", "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", @@ -762,7 +611,7 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_f83b5cc445e50f5f_EOF + GH_AW_MCP_CONFIG_47933e53337c2798_EOF - name: Download activation artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -775,11 +624,12 @@ jobs: id: agentic_execution # Copilot CLI tool arguments (sorted): # --allow-tool github - # --allow-tool mcpscripts # --allow-tool safeoutputs # --allow-tool shell(cat) + # --allow-tool shell(curl:*) # --allow-tool shell(date) # --allow-tool shell(echo) + # --allow-tool shell(gh:*) # --allow-tool shell(git add:*) # --allow-tool shell(git branch:*) # --allow-tool shell(git checkout:*) @@ -790,7 +640,6 @@ jobs: # --allow-tool shell(git switch:*) # --allow-tool shell(grep) # --allow-tool shell(head) - # --allow-tool shell(jq) # --allow-tool shell(ls) # --allow-tool shell(pwd) # --allow-tool shell(sort) @@ -798,6 +647,7 @@ jobs: # --allow-tool shell(uniq) # --allow-tool shell(wc) # --allow-tool shell(yq) + # --allow-tool web_fetch # --allow-tool write timeout-minutes: 20 run: | @@ -805,8 +655,8 @@ jobs: touch /tmp/gh-aw/agent-step-summary.md (umask 177 && touch /tmp/gh-aw/agent-stdio.log) # shellcheck disable=SC1003 - sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GH_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool mcpscripts --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(jq)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ + -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(curl:*)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(gh:*)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool web_fetch --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} @@ -816,7 +666,6 @@ jobs: GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} GH_AW_VERSION: v0.68.1 - GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} GITHUB_API_URL: ${{ github.api_url }} GITHUB_AW: true GITHUB_HEAD_REF: ${{ github.head_ref }} @@ -912,15 +761,6 @@ jobs: setupGlobals(core, github, context, exec, io, getOctokit); const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs'); await main(); - - name: Parse MCP Scripts logs for step summary - if: always() - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 - with: - script: | - const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); - setupGlobals(core, github, context, exec, io, getOctokit); - const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_scripts_logs.cjs'); - await main(); - name: Parse MCP Gateway logs for step summary if: always() id: parse-mcp-gateway @@ -979,7 +819,6 @@ jobs: /tmp/gh-aw/sandbox/agent/logs/ /tmp/gh-aw/redacted-urls.log /tmp/gh-aw/mcp-logs/ - /tmp/gh-aw/mcp-scripts/logs/ /tmp/gh-aw/agent_usage.json /tmp/gh-aw/agent-stdio.log /tmp/gh-aw/agent/ diff --git a/.github/workflows/course-updater.md b/.github/workflows/course-updater.md index bbe4baa..cb030bd 100644 --- a/.github/workflows/course-updater.md +++ b/.github/workflows/course-updater.md @@ -4,44 +4,15 @@ description: "Weekly check (Mondays) for new GitHub Copilot app features and upd on: schedule: weekly on monday workflow_dispatch: +permissions: + contents: read + pull-requests: read tools: - bash: ["date", "jq"] + bash: ["curl", "gh"] edit: + web-fetch: github: - toolsets: [repos] -mcp-scripts: - fetch-app-updates: - description: "Read changelog sections for recent Copilot app releases and return release and commit details from the past 7 days." - run: | - set -euo pipefail - since="$(node -p 'new Date(Date.now() - 7 * 86400000).toISOString().replace(/\.\d{3}Z$/, "Z")')" - releases="$(gh api --paginate --slurp 'repos/github/app/releases?per_page=100' | - jq --arg since "$since" '[.[][] | select(.published_at != null and .published_at >= $since) | {tag_name, published_at, html_url, body}]')" - tags="$(printf '%s' "$releases" | jq 'map(.tag_name)')" - printf '%s\n' '## Changelog: https://github.com/github/app/blob/main/changelog.md' - gh api 'repos/github/app/contents/changelog.md?ref=main' --jq '.content | @base64d' | - jq -Rrs --argjson tags "$tags" ' - [split("\n## ")[] | select(split("\n")[0] as $tag | $tags | index($tag)) | "## " + .] as $sections | - if ($sections | length) != ($tags | length) then - error("Missing changelog sections for recent releases") - else - $sections | join("\n") - end' - printf '\n## Releases since %s\n' "$since" - printf '%s\n' "$releases" - printf '\n## Commits since %s\n' "$since" - gh api --paginate --slurp "repos/github/app/commits?since=$since&per_page=100" | - jq '[.[][] | {sha, html_url, message: .commit.message, date: .commit.committer.date}]' - env: - GH_TOKEN: "${{ secrets.GH_AW_GITHUB_TOKEN }}" - fetch-open-update-prs: - description: "Return all open PRs with the automated-update or copilot-app-updates label. An empty array means no matching PRs." - run: | - set -euo pipefail - gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/pulls?state=open&per_page=100" | - jq '[.[][] | select(any(.labels[]; .name == "automated-update" or .name == "copilot-app-updates")) | {number, title, body, html_url}]' - env: - GH_TOKEN: "${{ secrets.GH_AW_GITHUB_TOKEN }}" + toolsets: [repos, pull_requests] post-steps: - name: Require a complete course update check if: always() @@ -79,16 +50,15 @@ You are a documentation maintainer for the Copilot App for Beginners repository. ## Step 1 — Gather recent Copilot app updates -Call `fetch-app-updates` (no inputs needed). This authenticated tool reads: +Use `web-fetch` to read the following page and extract the latest entries from the past 7 days: - https://github.com/github/app/blob/main/changelog.md — GitHub Copilot app changelog -- Releases and commits in `github/app` from the past 7 days -Use the returned changelog, release notes, and commit details to identify updates from the past 7 days. Do not use `web-fetch`, `curl`, or shell `gh` commands for these checks. +Use the authenticated GitHub MCP tools `list_releases` and `list_commits` to check the latest releases and commits in `github/app`. Only include updates from the past 7 days. -The tool result contains the fetched text in its `stdout` field. If a large result is saved to a file, use `jq -r '.stdout' ` to read that text. +If `web-fetch` or a shell `gh` command is denied or cannot authenticate, continue with the GitHub MCP tools. Release notes and commits are valid alternative sources when `web-fetch` cannot read the changelog. Use `get_file_contents` if you need to read the changelog through MCP. -If this tool or `fetch-open-update-prs` fails, report the error with `missing_data` or `missing_tool` and stop. Do not assume that a source repository is private, report that no updates are needed, or edit course content without the required source data. An incomplete check must fail the workflow. +If the authenticated MCP reads also fail, report the error with `missing_data` or `missing_tool` and stop. Do not assume that the repository is private or report that no updates are needed without source data. An incomplete check must fail the workflow. Look for: @@ -98,7 +68,9 @@ Look for: ## Step 2 — Check for existing open PRs to avoid duplicates -Before doing any content comparison, call `fetch-open-update-prs` (no inputs needed). It returns all open pull requests in this repo that have the `automated-update` or `copilot-app-updates` labels. Read their titles and descriptions to understand which features or changes each PR already covers. Build a list of features that are **already addressed** by existing PRs — you must exclude those features from any updates you propose later. If every feature you found in Step 1 is already covered by an open PR, stop here and call `noop` to report that no new updates are needed. +Before doing any content comparison, use the authenticated GitHub MCP `list_pull_requests` tool to list open pull requests in this repo. Select the PRs with either the `automated-update` or `copilot-app-updates` label. Read their titles and descriptions to understand which features or changes each PR already covers. Build a list of features that are **already addressed** by existing PRs — you must exclude those features from any updates you propose later. If every feature you found in Step 1 is already covered by an open PR, stop here and call `noop` to report that no new updates are needed. + +If the PR lookup fails, report `missing_data` or `missing_tool` and stop. Do not treat a failed lookup as an empty PR list. ## Step 3 — Compare against the current course content From 779b6e33d68fcdf1a32b28a58a662ebe720a43f9 Mon Sep 17 00:00:00 2001 From: Dan Wahlin Date: Mon, 5 Oct 2026 00:44:43 -0700 Subject: [PATCH 4/4] Approve GitHub URLs for Course Updater web fetching --- .github/workflows/course-updater.lock.yml | 30 +++++++++++------------ .github/workflows/course-updater.md | 3 +++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/course-updater.lock.yml b/.github/workflows/course-updater.lock.yml index 43e6d56..c52b718 100644 --- a/.github/workflows/course-updater.lock.yml +++ b/.github/workflows/course-updater.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"6824a20a04b2eb1964f296efab39f07df208b76edb76d21d15b64d8d03175b3d","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"5379ca57d743b9d37185a76fd2486f16161b8d4cd38598a080f9fdeafeb77404","compiler_version":"v0.68.1","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9"},{"repo":"actions/upload-artifact","sha":"bbbca2ddaa5d8feaa63e36b76fdaad77386f024f","version":"v7"},{"repo":"github/gh-aw-actions/setup","sha":"2fe53acc038ba01c3bbdc767d4b25df31ca5bdfc","version":"v0.68.1"}]} # ___ _ _ # / _ \ | | (_) @@ -158,19 +158,19 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' + cat << 'GH_AW_PROMPT_decf373b1839bfdd_EOF' - GH_AW_PROMPT_1ef59464ea60fd09_EOF + GH_AW_PROMPT_decf373b1839bfdd_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' + cat << 'GH_AW_PROMPT_decf373b1839bfdd_EOF' Tools: create_pull_request, missing_tool, missing_data, noop - GH_AW_PROMPT_1ef59464ea60fd09_EOF + GH_AW_PROMPT_decf373b1839bfdd_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_create_pull_request.md" - cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' + cat << 'GH_AW_PROMPT_decf373b1839bfdd_EOF' The following GitHub context information is available for this workflow: @@ -200,12 +200,12 @@ jobs: {{/if}} - GH_AW_PROMPT_1ef59464ea60fd09_EOF + GH_AW_PROMPT_decf373b1839bfdd_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_1ef59464ea60fd09_EOF' + cat << 'GH_AW_PROMPT_decf373b1839bfdd_EOF' {{#runtime-import .github/workflows/course-updater.md}} - GH_AW_PROMPT_1ef59464ea60fd09_EOF + GH_AW_PROMPT_decf373b1839bfdd_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 @@ -370,9 +370,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_4451e5082754bdc6_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_125f91baf6d3fd12_EOF' {"create_pull_request":{"base_branch":"main","labels":["automated-update","copilot-app-updates"],"max":1,"max_patch_size":1024,"protected_files":["package.json","bun.lockb","bunfig.toml","deno.json","deno.jsonc","deno.lock","global.json","NuGet.Config","Directory.Packages.props","mix.exs","mix.lock","go.mod","go.sum","stack.yaml","stack.yaml.lock","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","package-lock.json","yarn.lock","pnpm-lock.yaml","npm-shrinkwrap.json","requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","Gemfile","Gemfile.lock","uv.lock","CODEOWNERS"],"protected_path_prefixes":[".github/",".agents/"],"title_prefix":"[bot] "},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_4451e5082754bdc6_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_125f91baf6d3fd12_EOF - name: Write Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -570,7 +570,7 @@ jobs: export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.17' mkdir -p /home/runner/.copilot - cat << GH_AW_MCP_CONFIG_47933e53337c2798_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" + cat << GH_AW_MCP_CONFIG_09b6a1f599f904bb_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh" { "mcpServers": { "github": { @@ -611,7 +611,7 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_47933e53337c2798_EOF + GH_AW_MCP_CONFIG_09b6a1f599f904bb_EOF - name: Download activation artifact uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -656,7 +656,7 @@ jobs: (umask 177 && touch /tmp/gh-aw/agent-stdio.log) # shellcheck disable=SC1003 sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(curl:*)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(gh:*)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool web_fetch --allow-tool write --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-tool github --allow-tool safeoutputs --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(curl:*)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(gh:*)'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool web_fetch --allow-tool write --allow-all-paths --allow-url=https://github.com --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} @@ -1068,7 +1068,7 @@ jobs: (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) # shellcheck disable=SC1003 sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --env-all --exclude-env COPILOT_GITHUB_TOKEN --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,github.com,host.docker.internal,telemetry.enterprise.githubcopilot.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.18 --skip-pull --enable-api-proxy \ - -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + -- /bin/bash -c 'node ${RUNNER_TEMP}/gh-aw/actions/copilot_driver.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --allow-all-tools --allow-url=https://github.com --add-dir "${GITHUB_WORKSPACE}" --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log env: COPILOT_AGENT_RUNNER_TYPE: STANDALONE COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} diff --git a/.github/workflows/course-updater.md b/.github/workflows/course-updater.md index cb030bd..e0ae521 100644 --- a/.github/workflows/course-updater.md +++ b/.github/workflows/course-updater.md @@ -4,6 +4,9 @@ description: "Weekly check (Mondays) for new GitHub Copilot app features and upd on: schedule: weekly on monday workflow_dispatch: +engine: + id: copilot + args: ["--allow-url=https://github.com"] permissions: contents: read pull-requests: read