-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (105 loc) · 3.08 KB
/
codeql.yml
File metadata and controls
116 lines (105 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: "CodeQL"
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
schedule:
- cron: '30 5 * * 1,3'
- cron: '30 5,17 * * 2,4'
workflow_dispatch:
workflow_run:
workflows: ["Build"]
types: [requested]
branches:
- 'releases/**'
workflow_call:
outputs:
workflow_output1:
description: "The first job output"
value: ${{ jobs.my_job.outputs.job_output1 }}
workflow_output2:
description: "The second job output"
value: ${{ jobs.my_job.outputs.job_output2 }}
secrets:
access-token:
description: 'A token passed from the caller workflow'
required: false
jobs:
analyze:
name: Analyze (CodeQL)
runs-on: ubuntu-latest
# Example of job-level secrets; these secrets must exist in the repository
secrets:
COSMOS_KEY: ${{ secrets.COSMOS_KEY }}
COSMOS_ENDPOINT: ${{ secrets.COSMOS_ENDPOINT }}
strategy:
fail-fast: false
matrix:
include:
- language: c-cpp
build-mode: autobuild
- language: csharp
build-mode: autobuild
- language: go
build-mode: autobuild
- language: java
build-mode: autobuild
- language: rust
build-mode: autobuild
- language: swift
build-mode: autobuild
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
dependency-caching: ${{ matrix.language == 'java' }}
- if: ${{ matrix.build-mode == 'manual' }}
name: Build (manual)
run: |
make bootstrap
make release
- name: Autobuild
if: ${{ matrix.build-mode == 'autobuild' }}
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
test_schedule:
runs-on: ubuntu-latest
needs: analyze
steps:
- name: Not on Monday or Wednesday
if: github.event.schedule != '30 5 * * 1,3'
run: echo "This step will be skipped on Monday and Wednesday"
- name: Every time
run: echo "This step will always run"
my_job:
runs-on: ubuntu-latest
outputs:
job_output1: ${{ steps.set_outputs.outputs.out1 }}
job_output2: ${{ steps.set_outputs.outputs.out2 }}
steps:
- name: Set example outputs
id: set_outputs
run: |
echo "out1=done" >> $GITHUB_OUTPUT
echo "out2=ok" >> $GITHUB_OUTPUT
pass-secret-to-action:
runs-on: ubuntu-latest
needs: my_job
steps:
- name: Pass the received secret to an action
uses: ./.github/actions/my-action
with:
token: ${{ secrets.access-token }}
pass-secret-to-workflow:
needs: my_job
uses: ./.github/workflows/my-workflow
secrets:
token: ${{ secrets.access-token }}