-
Notifications
You must be signed in to change notification settings - Fork 5
Fix build pipeline and update JSON generation workflow #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
18d1e5d
build json generation pipeline
mymobanty 34d46f8
build pipeline fix
mymobanty 166d5b5
build pipeline fix
mymobanty cbd78c3
fixing overlay build path error
mymobanty 94888e3
fix name to bcbc-2024.json
mymobanty 8136e6f
workflow auth set
mymobanty 7986db2
changed branch to dev
mymobanty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| ROOT="$(pwd)" | ||
| AMENDMENTS_FILE="$ROOT/json-generation-pipeline/output/bc-amendments-combined.xml" | ||
| REVISIONS_FILE="$ROOT/json-generation-pipeline/output/bc-revisions-combined.xml" | ||
|
|
||
|
|
||
| java -jar json-generation-pipeline/tools/saxon.jar \ | ||
| -xsl:json-generation-pipeline/transformation-xslt/nbc-to-canonical.xsl \ | ||
| -s:json-generation-pipeline/source/nbc-2020-xml/nbc2020.xml \ | ||
| -o:json-generation-pipeline/output/nbc-canonical.xml | ||
|
|
||
|
|
||
| java -jar json-generation-pipeline/tools/saxon.jar \ | ||
| -xsl:json-generation-pipeline/transformation-xslt/combine-amendments.xsl \ | ||
| -s:json-generation-pipeline/source/bc-amendments/amendment-list.xml \ | ||
| -o:json-generation-pipeline/output/bc-amendments-combined.xml | ||
|
|
||
|
|
||
| java -jar json-generation-pipeline/tools/saxon.jar \ | ||
| -xsl:json-generation-pipeline/transformation-xslt/merge-engine-v3.xsl \ | ||
| -s:json-generation-pipeline/output/nbc-canonical.xml \ | ||
| overlay-document="file://$AMENDMENTS_FILE" \ | ||
| -o:json-generation-pipeline/output/bc-building-code.xml | ||
|
|
||
|
|
||
| java -jar json-generation-pipeline/tools/saxon.jar \ | ||
| -xsl:json-generation-pipeline/transformation-xslt/combine-amendments.xsl \ | ||
| -s:json-generation-pipeline/source/bc-revisions/revision-list.xml \ | ||
| -o:json-generation-pipeline/output/bc-revisions-combined.xml | ||
|
|
||
|
|
||
| java -jar json-generation-pipeline/tools/saxon.jar \ | ||
| -xsl:json-generation-pipeline/transformation-xslt/merge-engine-v3.xsl \ | ||
| -s:json-generation-pipeline/output/bc-building-code.xml \ | ||
| overlay-document="file://$REVISIONS_FILE" \ | ||
| -o:json-generation-pipeline/output/bc-building-code-final.xml | ||
|
|
||
|
|
||
| java -jar json-generation-pipeline/tools/saxon.jar \ | ||
| -xsl:json-generation-pipeline/transformation-xslt/canonical-to-json.xsl \ | ||
| -s:json-generation-pipeline/output/bc-building-code-final.xml \ | ||
| -o:json-generation-pipeline/output/bcbc-2024.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Generate BC Building Code Artifact | ||
|
|
||
| on: | ||
| workflow_dispatch: {} | ||
|
|
||
| jobs: | ||
| build: | ||
| # Allow run only when the workflow is dispatched from a branch | ||
| 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}\"}}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI about 2 months ago
In general, fix this by adding a
permissionsblock that restricts theGITHUB_TOKENto the minimal required scopes. Because this workflow only needs to read the repository contents (foractions/checkout) and does not perform any GitHub write operations withGITHUB_TOKEN, we can safely setcontents: read. Other steps that perform writes (the finalcurlcall) already use a separate secret token, so they do not require additionalGITHUB_TOKENscopes.The single best fix with no behavior change is to add a workflow-level
permissionsblock right after theon:section in.github/workflows/generate-artifact.yml, applying to all jobs. This block should be:No imports or additional methods are needed; this is purely a YAML configuration change inside the shown workflow file.