Skip to content

allowlist-check: verbose output and gh command to create allowlist PR#630

Merged
potiuk merged 2 commits intoapache:mainfrom
potiuk:allowlist-check-gh-command
Apr 4, 2026
Merged

allowlist-check: verbose output and gh command to create allowlist PR#630
potiuk merged 2 commits intoapache:mainfrom
potiuk:allowlist-check-gh-command

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Mar 30, 2026

Summary

Two improvements to the allowlist-check action:

  • Verbose output: Each action ref is now printed as it is checked, showing its
    status and the reason it was allowed or rejected. This makes it easy to see exactly
    what the check is doing without digging through workflow files.

    Checking 3 unique action ref(s) against the ASF allowlist:
    
      ✅ actions/checkout@v4 — trusted owner (actions)  (.github/workflows/ci.yml)
      ✅ codecov/codecov-action@v4 — matches allowlist  (.github/workflows/ci.yml)
      ❌ evil-org/evil-action@abc123 — NOT ON ALLOWLIST  (.github/workflows/ci.yml)
    
  • Ready-to-run gh command: On failure, the check now prints a copy-pasteable
    shell script that forks the repo, appends wildcard entries to actions.yml, and
    opens a PR — no manual file editing required.

    ::notice::You can create a PR to add the missing entries by running:
    ( set -e; _d=$(mktemp -d); trap 'rm -rf "$_d"' EXIT; cd "$_d"
      gh repo clone apache/infrastructure-actions . -- --depth=1
      gh repo fork --remote
      git checkout -b allowlist-add-evil-org-evil-action
      cat >> actions.yml << 'ALLOWLIST_YAML'
    evil-org/evil-action:
      '*':
        keep: true
    ALLOWLIST_YAML
      git add actions.yml
      git commit -m 'Add evil-org/evil-action to allowlist'
      git push -u origin allowlist-add-evil-org-evil-action
      gh pr create --repo apache/infrastructure-actions \
        --title 'Add evil-org/evil-action to the GitHub Actions allowlist' \
        --body '...' )
    

Test plan

  • TestBuildGhPrCommand (3 tests): single action, multiple actions with dedup, same action with different SHAs.
  • TestMainGhPrCommand (2 tests): verifies main() includes the PR command and verbose check output.
  • All 32 tests pass (27 existing + 5 new).

@potiuk potiuk requested review from dave2wave and raboof March 30, 2026 04:03
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Mar 30, 2026

cc: @kevinjqliu -enhanced your action with exact instructions to the maintainers how to create a PR to inftastructure-actions

@potiuk potiuk requested a review from dfoulks1 March 30, 2026 04:05
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Mar 30, 2026

Of course - literally two prompts to create it in less than 5 minues.

@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Mar 30, 2026

  • in actions/allowlist-check when there is a missing allowlist entry error, print exact gh command that will open necesary PR in the infrastructure-action repo
  • Actually the script should automatically generate a command that creates PR that adds this action (it only shown how to create issue initially about adding this action - instead I asked Claude to show script to create PR)

@potiuk potiuk force-pushed the allowlist-check-gh-command branch from d2bb8ce to 0154487 Compare March 30, 2026 04:11
@potiuk potiuk changed the title allowlist-check: print gh command to create allowlist PR allowlist-check: verbose output and gh command to create allowlist PR Mar 30, 2026
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Mar 30, 2026

And third prompt:

  • Also add verbose output when checking actions - showing the actions being checked

Added nice colorful verbose output while checking the actions.

Copy link
Copy Markdown
Member

@dave2wave dave2wave left a comment

Choose a reason for hiding this comment

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

Please provide clear for a human instructions on how to run a test.

@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Mar 30, 2026

Please provide clear for a human instructions on how to run a test.

It's already there added by @kevinjqliu (see https://github.com/apache/infrastructure-actions/blob/main/allowlist-check/README.md) - this PR merely improves the output of it by adding colors and improves the output to suggest a ready-to-copy-paste gh-command.

@potiuk potiuk requested a review from dave2wave March 30, 2026 22:54
Copy link
Copy Markdown
Member

@dave2wave dave2wave left a comment

Choose a reason for hiding this comment

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

I ran a test with the SHA of the PR.

Image

Copy link
Copy Markdown
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

this seems to promote discouraged behaviour

@raboof
Copy link
Copy Markdown
Member

raboof commented Apr 1, 2026

Of course - literally two prompts to create it in less than 5 minues.

"It took me really little work to create this work for you" really isn't a selling point IMHO

Copy link
Copy Markdown
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

thanks! this is helpful.

thoughts on adding a helper script in this repo?

@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Apr 2, 2026

Of course - literally two prompts to create it in less than 5 minues.

"It took me really little work to create this work for you" really isn't a selling point IMHO

True

potiuk added 2 commits April 4, 2026 11:15
When the check finds action refs not on the allowlist, print a
ready-to-run shell script that forks apache/infrastructure-actions,
appends wildcard entries to actions.yml, and opens a pull request —
all via the gh CLI with no manual file editing required.

Also add verbose output showing each action ref being checked, its
status (allowed/not allowed), and the reason (trusted owner, matches
allowlist, or not on allowlist).
fixup! allowlist-check: print gh command to create allowlist PR

- Use pinned versions instead of wildcards in generated entries
- Insert entries alphabetically via separate insert_actions.py script
- Download insert_actions.py from raw GitHub instead of inlining
- Push to fork and open PR from fork
- Generate one PR command per action, encourage one PR per action
@potiuk potiuk force-pushed the allowlist-check-gh-command branch from 0154487 to d4c18fd Compare April 4, 2026 09:40
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Apr 4, 2026

All comments addressed @dave2wave @raboof @kevinjqliu

@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Apr 4, 2026

Let me merge it here - I will check it on Airflow without releasing it, I think I addressed all comments, we can always fix it later,

@potiuk potiuk merged commit 4e9c961 into apache:main Apr 4, 2026
7 checks passed
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.

4 participants