From 0da037ca8f2ddc59eb95a94afcf32331d1c8af7d Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Tue, 4 Mar 2025 14:16:00 -0500 Subject: [PATCH] Expand gh secret acceptance tests This commit builds on top of work previously done within acceptance tests around gh secret and remote disambiguation. The choice of expanding this existing test rather than creating a new test was in order to keep context together within a single acceptance test rather than splitting it over multiple. --- ...secret-require-remote-disambiguation.txtar | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar b/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar index f4d1bbb4a..ebf5c79db 100644 --- a/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar +++ b/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar @@ -34,3 +34,26 @@ stderr 'multiple remotes detected. please specify which repo to use by providing # Secret delete requires disambiguation ! exec gh secret delete 'TEST_SECRET_NAME' stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument' + +# Move out of the fork repo to test whether secret commands work without local repository context +cd .. + +# Secret set using --repo flag does not require disambiguation +exec gh secret set 'TEST_SECRET_NAME' --body 'TEST_SECRET_VALUE' --repo ${ORG}/${REPO}-fork + +# Secret list using --repo flag does not require disambiguation +exec gh secret list --repo ${ORG}/${REPO}-fork +stdout 'TEST_SECRET_NAME' + +# Secret delete using --repo flag does not require disambiguation +exec gh secret delete 'TEST_SECRET_NAME' --repo ${ORG}/${REPO}-fork + +# Secret set using GH_REPO env var does not require disambiguation +exec gh secret set 'TEST_SECRET_NAME2' --body 'TEST_SECRET_VALUE2' --repo ${ORG}/${REPO}-fork + +# Secret list using --repo flag does not require disambiguation +exec gh secret list --repo ${ORG}/${REPO}-fork +stdout 'TEST_SECRET_NAME2' + +# Secret delete using --repo flag does not require disambiguation +exec gh secret delete 'TEST_SECRET_NAME2' --repo ${ORG}/${REPO}-fork