Skip to content

Commit b6a2c21

Browse files
authored
Setting job level permissions to workflows (#359)
1 parent eae1d57 commit b6a2c21

File tree

10 files changed

+40
-12
lines changed

10 files changed

+40
-12
lines changed

.github/workflows/alpha-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Release Alpha
2-
run-name: Release Alpha ${{ github.actor }} ${{ github.event_name }}
2+
run-name: Release Alpha ${{ inputs.version }} ${{ github.actor }} ${{ github.event_name }}
33

44
on:
55
workflow_dispatch:
@@ -9,6 +9,9 @@ on:
99
required: false
1010
default: 'main'
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
create-alpha-tag:
1417
runs-on: ubuntu-latest
@@ -42,9 +45,9 @@ jobs:
4245
fi
4346
4447
git tag "$TAG"
45-
git push origin "$TAG"
4648
echo "Created tag from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"
4749
50+
git push origin "$TAG"
4851
echo "tag=$TAG" >> $GITHUB_OUTPUT
4952
5053
call-release:

.github/workflows/benchmark.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- cron: '0 9 * * 3'
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
get-configs:
1316
uses: ./.github/workflows/configs.yml

.github/workflows/beta-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ run-name: Release Beta ${{ inputs.version }} ${{ github.actor }} ${{ github.even
44
on:
55
workflow_dispatch:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
create-beta-tag:
912
runs-on: ubuntu-latest
@@ -30,9 +33,9 @@ jobs:
3033
3134
TAG="v${PKG_VERSION}-beta"
3235
git tag "$TAG"
33-
git push origin "$TAG"
3436
echo "Created tag from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"
3537
38+
git push origin "$TAG"
3639
echo "tag=$TAG" >> $GITHUB_OUTPUT
3740
3841
call-release:

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
required: true
2929
type: string
3030

31+
permissions:
32+
contents: read
33+
3134
jobs:
3235
get-configs:
3336
uses: ./.github/workflows/configs.yml

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches: [ main ]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
build-and-test:
912
uses: ./.github/workflows/build-and-test.yml

.github/workflows/configs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
description: "Application name"
1414
value: ${{ jobs.get-app-name.outputs.app-name }}
1515

16+
permissions:
17+
contents: read
18+
1619
jobs:
1720
get-versions:
1821
runs-on: ubuntu-latest

.github/workflows/pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types: [opened, edited, reopened, synchronize]
66
branches: [ main ]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
get-configs:
1013
uses: ./.github/workflows/configs.yml

.github/workflows/prod-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
required: true
1010
type: string
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
promote-beta-to-prod:
1417
runs-on: ubuntu-latest
@@ -46,9 +49,9 @@ jobs:
4649
4750
# Create and push production tag
4851
git tag "$PROD_TAG"
49-
git push origin "$PROD_TAG"
50-
5152
echo "Created tag from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"
53+
54+
git push origin "$PROD_TAG"
5255
echo "tag=$PROD_TAG" >> $GITHUB_OUTPUT
5356
5457
call-release:

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
required: true
1717
type: string
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
get-configs:
2124
uses: ./.github/workflows/configs.yml

tools/benchmark.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/usr/bin/env node --expose-gc
22

3+
import { TelemetryService } from '../src/telemetry/TelemetryService';
4+
import { LoggerFactory } from '../src/telemetry/LoggerFactory';
5+
6+
LoggerFactory.initialize('silent');
7+
TelemetryService.initialize(undefined, {
8+
telemetryEnabled: false,
9+
});
10+
311
import { ContextManager } from '../src/context/ContextManager';
412
import { SyntaxTreeManager } from '../src/context/syntaxtree/SyntaxTreeManager';
513
import { readFileSync, writeFileSync, readdirSync, existsSync, mkdirSync } from 'fs';
@@ -9,8 +17,6 @@ import yargs from 'yargs';
917
import { hideBin } from 'yargs/helpers';
1018
import { discoverTemplateFiles, generatePositions, TestPosition } from './utils';
1119
import { DocumentType } from '../src/document/Document';
12-
import { TelemetryService } from '../src/telemetry/TelemetryService';
13-
import { LoggerFactory } from '../src/telemetry/LoggerFactory';
1420

1521
/**
1622
* This script benchmarks the performance of context resolution for CloudFormation templates,
@@ -854,11 +860,6 @@ function main(): void {
854860
process.exit(1);
855861
}
856862

857-
LoggerFactory.initialize('silent');
858-
TelemetryService.initialize(undefined, {
859-
telemetryEnabled: false,
860-
});
861-
862863
console.log(`📋 Found ${templateFiles.length} template files (sorted by size):`);
863864
for (const { name, documentType, size } of templateFiles) {
864865
const sizeKB = (size / 1024).toFixed(2);

0 commit comments

Comments
 (0)