Skip to content

Commit 1c63f96

Browse files
committed
Tighten Salesforce PR workflow gating
1 parent d2a1add commit 1c63f96

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666

6767
salesforce-integration:
6868
runs-on: ubuntu-latest
69+
name: Salesforce Integration
6970
env:
7071
RUN_SALESFORCE_INTEGRATION_TESTS: true
7172
SF_CONSUMER_KEY: ${{ secrets.SF_CONSUMER_KEY }}
@@ -93,24 +94,36 @@ jobs:
9394
fi
9495
done
9596
96-
- name: Skip when Salesforce secrets are missing
97+
- name: Resolve Salesforce test configuration
98+
id: salesforce-config
9799
run: |
98100
missing=0
99101
for key in SF_CONSUMER_KEY SF_CONSUMER_SECRET SF_USERNAME SF_PASSWORD; do
100102
if [ -z "${!key}" ]; then
101-
echo "Skipping Salesforce integration tests because $key is not configured."
103+
echo "Missing Salesforce secret: $key"
102104
missing=1
103105
fi
104106
done
105-
if [ "$missing" -ne 0 ]; then
106-
exit 0
107-
fi
107+
108108
if [ -z "$SF_LOGIN_URL" ]; then
109109
echo "SF_LOGIN_URL=https://login.salesforce.com" >> "$GITHUB_ENV"
110110
fi
111111
112+
if [ "$missing" -ne 0 ]; then
113+
echo "can_run=false" >> "$GITHUB_OUTPUT"
114+
exit 0
115+
fi
116+
117+
echo "can_run=true" >> "$GITHUB_OUTPUT"
118+
119+
- name: Skip Salesforce integration test
120+
if: steps.salesforce-config.outputs.can_run != 'true'
121+
run: echo "Skipping Salesforce integration tests because the required GitHub secrets are not configured for this pull request."
122+
112123
- name: Install dependencies
124+
if: steps.salesforce-config.outputs.can_run == 'true'
113125
run: composer update --prefer-stable --prefer-dist --no-interaction --no-suggest
114126

115127
- name: Execute Salesforce integration test
128+
if: steps.salesforce-config.outputs.can_run == 'true'
116129
run: vendor/bin/phpunit --filter UserPasswordIntegrationTest

0 commit comments

Comments
 (0)