Skip to content

Commit 6821122

Browse files
committed
Merge branch 'main' into bundled-navigation-data
2 parents 19f2e3e + f967a54 commit 6821122

File tree

5 files changed

+70
-13
lines changed

5 files changed

+70
-13
lines changed

.github/workflows/autolabel.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Label PR
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
BOT_TOKEN:
7+
required: true
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
autolabel:
15+
runs-on: ubuntu-latest
16+
name: Automatically Label PR
17+
if: ${{ !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name , 'release') }}
18+
steps:
19+
- uses: actions/[email protected]
20+
with:
21+
github-token: ${{ secrets.BOT_TOKEN }}
22+
script: |
23+
const labelPatterns = {
24+
feature: ["feature/*", "feat/*"],
25+
fix: "fix/*",
26+
chore: "chore/*",
27+
docs: "docs/*",
28+
refactor: "refactor/*",
29+
ci: "ci/*"
30+
};
31+
32+
const branchName = context.payload.pull_request.head.ref
33+
const labelsToAdd = [];
34+
35+
for (const label in labelPatterns) {
36+
const patterns = Array.isArray(labelPatterns[label]) ? labelPatterns[label] : [labelPatterns[label]];
37+
for (const pattern of patterns) {
38+
if (branchName.match(new RegExp(`^${pattern.replace('*', '.*')}$`))) {
39+
labelsToAdd.push(label);
40+
break;
41+
}
42+
}
43+
}
44+
45+
if (labelsToAdd.length > 0) {
46+
core.info(`ℹ️ Matched the following labels: ${labelsToAdd.join(", ")}`)
47+
48+
github.rest.issues.addLabels({
49+
...context.repo,
50+
issue_number: context.payload.pull_request.number,
51+
labels: labelsToAdd
52+
})
53+
} else {
54+
core.info(`ℹ️ The HEAD ref of this PR does not match any of the specified patterns.`)
55+
}

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Label, Build & Lint PR
1010

1111
jobs:
1212
autolabel:
13-
uses: Navigraph/workflows/.github/workflows/autolabel.yml@main
13+
uses: ./.github/workflows/autolabel.yml
1414
secrets: inherit
1515

1616
filter:
@@ -22,7 +22,7 @@ jobs:
2222
example: ${{ steps.changes.outputs.example }}
2323
steps:
2424
- uses: actions/checkout@v4
25-
- uses: dorny/paths-filter@v2
25+
- uses: dorny/paths-filter@v3
2626
id: changes
2727
with:
2828
filters: |

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ The default location for navigation data is `work/NavigationData`. If you have b
4040

4141
## Building the Sample Aircraft
4242

43-
Before building, make sure you have properly created and set an `.env` file in `src/gauge`! An example can be found in the `.env.example` file in that directory. Replace with your credentials
43+
Before building, make sure you have properly created and set an `.env` file in `examples/gauge`! An example can be found in the `.env.example` file in that directory. Replace with your credentials
4444

4545
1. [Download](https://nodejs.org/en/download) Node.js
46-
2. Open the `src/gauge` folder in a terminal
46+
2. Open the `examples/gauge` folder in a terminal
4747
3. Run `npm i` the first time you build, in order to install dependencies
4848
4. Run `npm run build` to build into the `PackageSources` folder of the aircraft sample (or `npm run dev` to build into the `Packages` folder of the aircraft and listen to changes in the source).
49-
5. Make sure the WASM module is included in the `panel` folder! Look at either [Including in Your Aircraft](#including-in-your-aircraft) or [Building the WASM Module Yourself](#building-the-wasm-module-yourself) for info on that
49+
5. Make sure the WASM module is included in the [`panel`](examples/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel) folder! Look at either [Including in Your Aircraft](#including-in-your-aircraft) or [Building the WASM Module Yourself](#building-the-wasm-module-yourself) for info on that
5050
6. Open the `examples/aircraft/NavigationDataInterfaceAircraftProject.xml` file in the simulator and build there
5151

5252
## Building the WASM Module Yourself

examples/gauge/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Gauge example
2-
3-
This is a simple JavaScript gauge to interface with the WASM module.
4-
5-
## Building
6-
7-
To build to your `Packages` folder and listen to changes (i.e. when you're debugging or quickly prototyping) you can run `npm run dev`. Otherwise, run `npm run build`
1+
# Gauge example
2+
3+
This is a simple JavaScript gauge to interface with the WASM module.
4+
5+
## Building
6+
7+
To build to your `Packages` folder and listen to changes (i.e. when you're debugging or quickly prototyping) you can run `npm run dev`. Otherwise, run `npm run build`
8+
9+
- Note: `npm run dev` will output once into the `PackageSources` folder initially to prevent cases where the `build` command isn't ran before building in the sim which would lead to errors

examples/gauge/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"build": "cross-env DEBUG=false npx rollup -c",
8-
"dev": "cross-env DEBUG=true npx rollup -cw"
8+
"dev": "cross-env DEBUG=false npx rollup -c && cross-env DEBUG=true npx rollup -cw"
99
},
1010
"keywords": [],
1111
"author": "",

0 commit comments

Comments
 (0)