Skip to content

Fix build pipeline and update JSON generation workflow#12

Merged
mymobanty merged 7 commits into
developfrom
feature/IC2026-19_syncrepo2repo
Mar 31, 2026
Merged

Fix build pipeline and update JSON generation workflow#12
mymobanty merged 7 commits into
developfrom
feature/IC2026-19_syncrepo2repo

Conversation

@mymobanty
Copy link
Copy Markdown
Collaborator

No description provided.

Comment on lines +9 to +43
if: ${{ github.ref == 'refs/heads/develop' }}

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Run transformation pipeline
run: bash .github/scripts/run-pipeline.sh


- name: Upload combined artifact
uses: actions/upload-artifact@v4
with:
name: bc-building-code-artifact
path: |
json-generation-pipeline/output/**
bc-graphics/**
graphics/**

- name: Trigger Repo B sync
if: success()
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.REPO_B_TRIGGER_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/bcgov/HOUS-Interactive-BCBC/dispatches \
-d "{\"event_type\":\"sync-from-repo-a\",\"client_payload\":{\"branch\":\"${GITHUB_REF_NAME}\"}}"

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 about 2 months ago

In general, fix this by adding a permissions block that restricts the GITHUB_TOKEN to the minimal required scopes. Because this workflow only needs to read the repository contents (for actions/checkout) and does not perform any GitHub write operations with GITHUB_TOKEN, we can safely set contents: read. Other steps that perform writes (the final curl call) already use a separate secret token, so they do not require additional GITHUB_TOKEN scopes.

The single best fix with no behavior change is to add a workflow-level permissions block right after the on: section in .github/workflows/generate-artifact.yml, applying to all jobs. This block should be:

permissions:
  contents: read

No imports or additional methods are needed; this is purely a YAML configuration change inside the shown workflow file.

Suggested changeset 1
.github/workflows/generate-artifact.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/generate-artifact.yml b/.github/workflows/generate-artifact.yml
--- a/.github/workflows/generate-artifact.yml
+++ b/.github/workflows/generate-artifact.yml
@@ -3,6 +3,9 @@
 on:
   workflow_dispatch: {}
 
+permissions:
+  contents: read
+
 jobs:
   build:
     # Allow run only when the workflow is dispatched from a branch
EOF
@@ -3,6 +3,9 @@
on:
workflow_dispatch: {}

permissions:
contents: read

jobs:
build:
# Allow run only when the workflow is dispatched from a branch
Copilot is powered by AI and may make mistakes. Always verify output.
@mymobanty mymobanty requested a review from ratheesh-aot March 31, 2026 17:14
Copy link
Copy Markdown
Collaborator

@ratheesh-aot ratheesh-aot left a comment

Choose a reason for hiding this comment

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

LGTM!

@mymobanty mymobanty merged commit aec9f7a into develop Mar 31, 2026
3 checks passed
@mymobanty mymobanty deleted the feature/IC2026-19_syncrepo2repo branch March 31, 2026 20:09
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.

3 participants