Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

Review and Test github/pr Action - COMPLETE ✅

Task Summary

Reviewed the cleanup commit (691d1f4) for gh-actions/github/pr and added comprehensive tests.

Review Findings ✅

Cleanup commit is CORRECT - No breaking changes found

  1. Diff handling - Correctly delegated to upload/diff action (removed duplication)
  2. Input processing - All critical inputs properly wired through jq filter
  3. Shell quoting - Proper use of @sh for title and commit_message
  4. Envoy compatibility - All usage patterns in envoy-release.yml and envoy-dependency.yml work correctly

Envoy Usage Analysis

  • envoy-release.yml: 5 uses with commit: false, dry-run, diff-upload, diff-show
  • envoy-dependency.yml: 3 uses with custom committer, commit-message, working-directory
  • All patterns verified compatible with current implementation

Tests Added ✅

Created 7 comprehensive tests using mock pattern from PR #3173:

  1. dry-run.test.yml - Verifies dry-run prevents push/PR creation
  2. commit.test.yml - Tests commit with custom committer config
  3. no-commit.test.yml - Tests commit:false mode (envoy pattern)
  4. working-directory.test.yml - Tests subdir execution
  5. commit-message-fallback.test.yml - Tests title fallback when no commit-message
  6. special-characters.test.yml - Tests shell quoting/escaping safety
  7. pr-creation.test.yml - Tests actual PR creation (mocked)

Mocking Implementation

  • Separate mock scripts in mocks/ directory (gh and git)
  • git mock: Mocks all commands used by create.sh (log, checkout, config, commit, push) - does NOT call real git
  • gh mock: Mocks pr create command - does NOT call real gh
  • Log files record all calls for verification
  • Test data setup happens BEFORE mocks are added to PATH

Coverage

Tests cover all critical code paths and envoy usage patterns including:

  • Branch creation
  • Committing with/without custom committer
  • Signoff appending
  • Working directory changes
  • Shell quoting safety
  • Dry-run vs real execution

Changes Made

  • Removed deprecated append-commit-message and wip input fields (were defined but never used)
  • Fixed test token usage to use "VERYSECRET" instead of secrets reference
  • Fixed recursive fork bomb by mocking all git commands instead of passing through
Original prompt

i just landed a cleanup for gh-actions/github/pr

the problem is this action has no tests, but its used quite a bit in the envoyproxy/envoy repo

first task is to understand how envoy uses it, then go through the change with fine tooth comb and make sure 100% that nothing was broken

finally we need to add some action tests for github/pr if you look at github/checkout and gh-actions/gpg you will see recently added tests that are good as ref impl


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 58c74f1
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/695297eb7ce381000861659c
😎 Deploy Preview https://deploy-preview-3271--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Add tests for github/pr action and clean up code Add tests for gh-actions/github/pr and verify cleanup commit Dec 29, 2025
Copilot AI requested a review from phlax December 29, 2025 11:23
@phlax
Copy link
Member

phlax commented Dec 29, 2025

@copilot secret.GITHUB_TOKEN no work - just make it "VERYSECRET" its not going to be used (and should not be)

also remove the README

re deprecated field - just remove it

Copy link
Contributor Author

Copilot AI commented Dec 29, 2025

@copilot secret.GITHUB_TOKEN no work - just make it "VERYSECRET" its not going to be used (and should not be)

also remove the README...

Fixed in adefeaf:

  • Replaced secrets.GITHUB_TOKEN with "VERYSECRET" in all 7 test files
  • Removed append-commit-message input field from action.yml
  • Removed wip input field from action.yml

No README existed to remove.

@phlax
Copy link
Member

phlax commented Dec 29, 2025

@copilot ooms with

export PR_BRANCH='test/pr-action-basic'
export PR_DRY_RUN='true'
export PR_TITLE='Test PR'
export PR_DO_COMMIT='true'
export PR_COMMITTER_EMAIL='null'
export PR_COMMITTER_NAME='null'
export PR_COMMIT_MESSAGE=''
cd .
${PR_ACTION_PATH}/create.sh
Run # Run generated script
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
/home/runner/work/toolshed/toolshed/gh-actions/github/pr/tests/mocks/git: fork: retry: Resource temporarily unavailable
Prepare all required actions
Getting action download info
Run ./.tmp.action
Run # Setup mock PATH
[detached HEAD afd8914] Test commit
1 file changed, 1 insertion(+)
create mode 100644 test-file.txt
Prepare all required actions
Getting action download info
Getting action download info
Getting action download info
Download action repository 'actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f' (SHA:b7c566a772e6b6bfb58ed0dc250532a479d7789f)
Run ./gh-actions/github/pr
Run 368bc11
Run # Create temporary script file
Run c790901
export PR_BODY='This is a test PR'
export PR_BASE='main'
export PR_BRANCH='test/pr-action-basic'
export PR_DRY_RUN='true'
export PR_TITLE='Test PR'
export PR_DO_COMMIT='true'
export PR_COMMITTER_EMAIL='null'
export PR_COMMITTER_NAME='null'
export PR_COMMIT_MESSAGE=''
cd .
${PR_ACTION_PATH}/create.sh
Run # Run generated script
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
bash: warning: shell level (1000) too high, resetting to 1
/home/runner/work/toolshed/toolshed/gh-actions/github/pr/tests/mocks/git: fork: retry: Resource temporarily unavailable
/home/runner/work/toolshed/toolshed/gh-actions/github/pr/tests/mocks/git: fork: retry: Resource temporarily unavailable

something is calling itself

Copy link
Contributor Author

Copilot AI commented Dec 29, 2025

@copilot ooms with

...

Fixed in 7e2c089:

  • Mock git now handles all commands (log, checkout, config, commit, push) without calling real git
  • Mock gh already didn't call real gh
  • Test setup moved BEFORE adding mocks to PATH so real git is used only for test data preparation
  • No more recursive calls or fork bombs

@phlax phlax force-pushed the copilot/cleanup-gh-actions-pr-tests branch 2 times, most recently from b97c947 to 9a3e117 Compare December 29, 2025 14:55
@phlax phlax changed the title Add tests for gh-actions/github/pr and verify cleanup commit gh-actions/github/pr: Add tests and cleanups/fixes Dec 29, 2025
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
@phlax phlax force-pushed the copilot/cleanup-gh-actions-pr-tests branch from f26ae02 to 58c74f1 Compare December 29, 2025 15:02
@phlax phlax marked this pull request as ready for review December 29, 2025 15:05
@phlax phlax merged commit f8fccb4 into main Dec 29, 2025
74 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.

2 participants