fix: ephemeral envs fail on noop (#31236)
This commit is contained in:
parent
73d21a87ae
commit
654701af4c
|
|
@ -35,22 +35,26 @@ jobs:
|
|||
|
||||
- name: Eval comment body for /testenv slash command
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
COMMENT_BODY: ${{ github.event.inputs.comment_body || github.event.comment.body }}
|
||||
id: eval-body
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const pattern = /^\/testenv (up|down)/;
|
||||
const result = pattern.exec('${{ github.event.inputs.comment_body || github.event.comment.body }}');
|
||||
const result = pattern.exec(process.env.COMMENT_BODY || '');
|
||||
return result === null ? 'noop' : result[1];
|
||||
|
||||
- name: Looking for feature flags
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
COMMENT_BODY: ${{ github.event.inputs.comment_body || github.event.comment.body }}
|
||||
id: eval-feature-flags
|
||||
with:
|
||||
script: |
|
||||
const pattern = /FEATURE_(\w+)=(\w+)/g;
|
||||
let results = [];
|
||||
[...'${{ github.event.inputs.comment_body || github.event.comment.body }}'.matchAll(pattern)].forEach(match => {
|
||||
[...process.env.COMMENT_BODY.matchAll(pattern)].forEach(match => {
|
||||
const config = {
|
||||
name: `SUPERSET_FEATURE_${match[1]}`,
|
||||
value: match[2],
|
||||
|
|
@ -88,9 +92,7 @@ jobs:
|
|||
const action = '${{ steps.eval-body.outputs.result }}';
|
||||
const runId = context.runId;
|
||||
const workflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
|
||||
const body = action === 'noop'
|
||||
? `@${user} No ephemeral environment action detected. Please use '/testenv up' or '/testenv down'. [View workflow run](${workflowUrl}).`
|
||||
: `@${user} Processing your ephemeral environment request [here](${workflowUrl}).`;
|
||||
const body = `@${user} Processing your ephemeral environment request [here](${workflowUrl}).`;
|
||||
if (action !== 'noop') {
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
|
|
@ -99,13 +101,16 @@ jobs:
|
|||
body,
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
core.setFailed('No ephemeral environment action detected.');
|
||||
}
|
||||
|
||||
ephemeral-docker-build:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.inputs.issue_number || github.event.issue.number || github.run_id }}-build
|
||||
cancel-in-progress: true
|
||||
needs: ephemeral-env-comment
|
||||
if: needs.ephemeral-env-comment.outputs.slash-command == 'up'
|
||||
name: ephemeral-docker-build
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
|
|
|||
Loading…
Reference in New Issue