Skip to content

Tee the org-permissions diagnostic to the job log - #177

Merged
eliorerz merged 1 commit into
mainfrom
tee-org-perms-to-log
Aug 7, 2026
Merged

Tee the org-permissions diagnostic to the job log#177
eliorerz merged 1 commit into
mainfrom
tee-org-perms-to-log

Conversation

@eliorerz

@eliorerz eliorerz commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What

#175's diagnostic dispatch (run 31149352826) worked correctly -- but its output only landed in `$GITHUB_STEP_SUMMARY`, which turns out not to be retrievable via the REST or GraphQL API at all, only rendered in the Actions web UI. Tees the same output to stdout too, so it's readable from `gh run view --log` / the normal job log.

Context

Separately: a second, non-diagnostic dispatch of `apply.yaml` in the meantime hit the same known #173 permission-string failure again and re-filed the apply-failure issue as #176 (after #174 was closed). That's expected -- `organization.tf` still has the broken `manage_organization_runners` string until this diagnostic actually confirms the right one. Once this merges I'll dispatch once more with both `list_org_fine_grained_permissions=true` and `exclude_addresses=github_organization_role.runner_manager,github_organization_role_team.runner_manager_wg_infra` together, to get the real string without re-triggering the failure.

NO-ISSUE

Summary by CodeRabbit

  • Chores
    • Improved workflow reporting so permission results are displayed both in live logs and in the summarized workflow output.
    • No changes to the application’s functionality or user experience.

$GITHUB_STEP_SUMMARY content isn't retrievable via the REST/GraphQL
API -- only the Actions web UI renders it. Tee the same output to
stdout too, so it's readable from a normal 'gh run view --log'.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The permissions-reporting step now uses tee to write output to both the live workflow log and GITHUB_STEP_SUMMARY.

Changes

Permissions reporting

Layer / File(s) Summary
Write report to log and summary
.github/workflows/apply.yaml
The permissions-reporting pipeline uses tee to retain live step-log output while writing to GITHUB_STEP_SUMMARY.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: sending the org-permissions diagnostic to the job log with tee.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed The only added line pipes existing permission output through tee; it adds no credential literal, key material, embedded-credential URL, or secret assignment.
No-Weak-Crypto ✅ Passed The PR changes only workflow output piping from redirection to tee; no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons are introduced.
No-Injection-Vectors ✅ Passed The one-line change only pipes jq output to quoted tee -a "$GITHUB_STEP_SUMMARY"; it adds no SQL, eval/exec, shell=True, unsafe YAML, pickle, os.system, or HTML injection sink.
Container-Privileges ✅ Passed The PR only changes >> "$GITHUB_STEP_SUMMARY" to | tee -a "$GITHUB_STEP_SUMMARY"; the workflow uses runs-on: ubuntu-latest and adds no privileged, host*, SYS_ADMIN, or root settings.
No-Sensitive-Data-In-Logs ✅ Passed The change only tees organization permission names and descriptions to stdout; it does not log tokens, credentials, PII, hostnames, or customer data.
Ai-Attribution ✅ Passed The authored PR description and commits do not mention AI tools; the commit audit found no AI markers, no Co-Authored-By trailer, and no attribution requirement was triggered.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tee-org-perms-to-log

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/apply.yaml:
- Line 97: Update the workflow step containing the jq-to-tee summary pipeline to
enable Bash pipefail, either by declaring shell: bash with pipefail enabled or
by running set -o pipefail before the pipeline, so jq failures propagate instead
of being masked by tee.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2f4dc9a5-8e34-4fee-8c75-a471ec10feaa

📥 Commits

Reviewing files that changed from the base of the PR and between 00fcde0 and 30d65b9.

📒 Files selected for processing (1)
  • .github/workflows/apply.yaml

echo "### Runner-related"
jq -r '.[] | select(.description | test("runner"; "i")) | "- `\(.name)`: \(.description)"' /tmp/org-perms.json
} >> "$GITHUB_STEP_SUMMARY"
} | tee -a "$GITHUB_STEP_SUMMARY"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 4 '(^[[:space:]]*shell:|set -o pipefail|tee -a "\$GITHUB_STEP_SUMMARY")' .github/workflows/apply.yaml

Repository: osac-project/github-config

Length of output: 607


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- workflow context ---'
sed -n '1,115p' .github/workflows/apply.yaml
printf '%s\n' '--- shell and pipefail references ---'
rg -n -C 3 '(^[[:space:]]*shell:|set([[:space:]]+-[a-zA-Z]*|[[:space:]]+)?[[:space:]]*[^#]*pipefail|tee -a "\$GITHUB_STEP_SUMMARY")' .github/workflows/apply.yaml

Repository: osac-project/github-config

Length of output: 6201


Enable pipefail for the summary pipeline.

This step uses the default bash -e shell, so a failed jq command can be masked by a successful tee. Add shell: bash or run set -o pipefail before the pipeline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/apply.yaml at line 97, Update the workflow step containing
the jq-to-tee summary pipeline to enable Bash pipefail, either by declaring
shell: bash with pipefail enabled or by running set -o pipefail before the
pipeline, so jq failures propagate instead of being masked by tee.

@eliorerz
eliorerz merged commit b7a784a into main Aug 7, 2026
3 checks passed
@eliorerz
eliorerz deleted the tee-org-perms-to-log branch August 7, 2026 05:11
eliorerz added a commit that referenced this pull request Aug 7, 2026
The live organization-fine-grained-permissions API rejected
manage_organization_runners (422); a one-time diagnostic dispatch
(github-config#175, #177) confirmed the real identifier is
write_organization_runners_and_runner_groups ("Manage organization
runners and runner groups"). Fix the role's permissions list, and
remove the diagnostic step and its input entirely -- it was genuinely
one-time (unlike exclude_addresses/state_rm_addresses/import_address,
which are reusable escape hatches), so apply.yaml is restored to its
pre-#175 shape.

NO-ISSUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant