Skip to content

Commit a8f1feb

Browse files
authored
Merge pull request #1 from nutcas3/workflows
Add GitHub Actions workflows for CodeQL analysis, greetings, release,…
2 parents 814fa92 + 6f7b324 commit a8f1feb

File tree

4 files changed

+139
-0
lines changed

4 files changed

+139
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '22 5 * * 5'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
15+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
16+
permissions:
17+
security-events: write
18+
19+
packages: read
20+
21+
actions: read
22+
contents: read
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- language: rust
29+
build-mode: autobuild
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
36+
- name: Initialize CodeQL
37+
uses: github/codeql-action/init@v3
38+
with:
39+
languages: ${{ matrix.language }}
40+
build-mode: ${{ matrix.build-mode }}
41+
42+
43+
44+
- if: matrix.build-mode == 'manual'
45+
shell: bash
46+
run: |
47+
echo 'If you are using a "manual" build mode for one or more of the' \
48+
'languages you are analyzing, replace this with the commands to build' \
49+
'your code, for example:'
50+
echo ' make bootstrap'
51+
echo ' make release'
52+
exit 1
53+
54+
- name: Perform CodeQL Analysis
55+
uses: github/codeql-action/analyze@v3
56+
with:
57+
category: "/language:${{matrix.language}}"

.github/workflows/greetings.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Greetings
2+
3+
on: [pull_request_target, issues]
4+
5+
jobs:
6+
greeting:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
steps:
12+
- uses: actions/first-interaction@v1
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
issue-message: "Message that will be displayed on users' first issue"
16+
pr-message: "Message that will be displayed on users' first pull request"

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Install Rust
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
override: true
23+
24+
- name: Build release binary
25+
run: cargo build --release
26+
27+
- name: Upload release asset
28+
uses: softprops/action-gh-release@v2
29+
with:
30+
files: target/release/*
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/summary.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Summarize new issues
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
summary:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
models: read
13+
contents: read
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Run AI inference
20+
id: inference
21+
uses: actions/ai-inference@v1
22+
with:
23+
prompt: |
24+
Summarize the following GitHub issue in one paragraph:
25+
Title: ${{ github.event.issue.title }}
26+
Body: ${{ github.event.issue.body }}
27+
28+
- name: Comment with AI summary
29+
run: |
30+
gh issue comment $ISSUE_NUMBER --body '${{ steps.inference.outputs.response }}'
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
ISSUE_NUMBER: ${{ github.event.issue.number }}
34+
RESPONSE: ${{ steps.inference.outputs.response }}

0 commit comments

Comments
 (0)