This is an automated email from the ASF dual-hosted git repository.
dpgaspar pushed a commit to branch fix/ephemeral-envs-v2
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/fix/ephemeral-envs-v2 by this
push:
new f1f5b3e56c fix(ci): ephemeral env, handle different label, create
comment
f1f5b3e56c is described below
commit f1f5b3e56ce5287276ea02ba106e754fc035c9aa
Author: Daniel Gaspar <[email protected]>
AuthorDate: Thu Jan 30 13:33:55 2025 +0000
fix(ci): ephemeral env, handle different label, create comment
---
.github/workflows/ephemeral-env.yml | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/ephemeral-env.yml
b/.github/workflows/ephemeral-env.yml
index 0529fbe681..ea29805c98 100644
--- a/.github/workflows/ephemeral-env.yml
+++ b/.github/workflows/ephemeral-env.yml
@@ -50,17 +50,45 @@ jobs:
echo "result=up" >> $GITHUB_OUTPUT
else
echo "result=noop" >> $GITHUB_OUTPUT
- exit 0
fi
- name: Get event SHA
id: get-sha
- run: |
- echo "sha=${{ github.event.pull_request.head.sha }}" >>
$GITHUB_OUTPUT
+ if: steps.eval-label.outputs.result == 'up'
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ let prSha;
+
+ // If event is workflow_dispatch, use the issue_number from inputs
+ if (context.eventName === "workflow_dispatch") {
+ const prNumber = "${{ github.event.inputs.issue_number }}";
+ if (!prNumber) {
+ console.log("No PR number found.");
+ return;
+ }
+
+ // Fetch PR details using the provided issue_number
+ const { data: pr } = await github.rest.pulls.get({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: prNumber
+ });
+
+ prSha = pr.head.sha;
+ } else {
+ // If it's not workflow_dispatch, use the PR head sha from the
event
+ prSha = context.payload.pull_request.head.sha;
+ }
+
+ console.log(`PR SHA: ${prSha}`);
+ core.setOutput("sha", prSha);
- name: Looking for feature flags in PR description
uses: actions/github-script@v7
id: eval-feature-flags
+ if: steps.eval-label.outputs.result == 'up'
with:
script: |
const description = context.payload.pull_request
@@ -81,6 +109,7 @@ jobs:
- name: Reply with confirmation comment
uses: actions/github-script@v7
+ if: steps.eval-label.outputs.result == 'up'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |