Skip to content

Commit 8cf6e43

Browse files
committed
ci: Fix copy/paste error
1 parent 3db7644 commit 8cf6e43

File tree

1 file changed

+27
-94
lines changed

1 file changed

+27
-94
lines changed

.github/workflows/codeql.yaml

Lines changed: 27 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,39 @@
1-
name: Release New Version
1+
name: CodeQL
22

33
on:
4-
workflow_dispatch:
54
push:
65
branches:
76
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '45 13 * * *'
812

913
jobs:
10-
# Builds a new release for the module by bumping the version number and
11-
# generating a changelog entry. Commit the changes and open a pull request.
12-
build-release:
13-
name: Build new release
14-
runs-on: ubuntu-latest
15-
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
14+
analyze:
15+
name: Analyze (${{ matrix.language }})
16+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
1617
permissions:
17-
contents: write
18-
pull-requests: write
18+
security-events: write
19+
packages: read
20+
actions: read
21+
contents: read
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- language: actions
27+
build_mode: none
1928
steps:
20-
- name: Checkout source code
29+
- name: Checkout repository
2130
uses: actions/checkout@v6
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v4
2233
with:
23-
fetch-depth: 0
24-
- name: Bump version and create changelog
25-
id: bump
26-
uses: commitizen-tools/commitizen-action@0.27.0
27-
with:
28-
push: false
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
30-
git_redirect_stderr: true
31-
- name: Get the commit message
32-
id: message
33-
run: |
34-
MESSAGE=$(git log --format=%B -n 1)
35-
echo "message=${MESSAGE}" >> $GITHUB_OUTPUT
36-
- name: Open a pull request for the release
37-
uses: peter-evans/create-pull-request@v8
34+
languages: ${{ matrix.language }}
35+
build-mode: ${{ matrix.build-mode }}
36+
- name: Perform CodeQL Analysis
37+
uses: github/codeql-action/analyze@v4
3838
with:
39-
branch: release-${{ steps.bump.outputs.version }}
40-
title: ${{ steps.message.outputs.message }}
41-
42-
# Creates a new tag and GitHub release for the module.
43-
release:
44-
name: Release module
45-
runs-on: ubuntu-latest
46-
if: startsWith(github.event.head_commit.message, 'bump:')
47-
permissions:
48-
contents: write
49-
steps:
50-
- name: Checkout source code
51-
uses: actions/checkout@v6
52-
- name: Get the module name
53-
id: module_name
54-
run: |
55-
REPO_NAME="${{ github.event.repository.name }}"
56-
REPO_NAME="${REPO_NAME/tofu-modules-/}"
57-
MODULE_NAME="${REPO_NAME//-/_}"
58-
echo "name=${MODULE_NAME}" >> $GITHUB_OUTPUT
59-
- name: Get the version from the commit message
60-
id: version
61-
uses: actions/github-script@v8
62-
env:
63-
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
64-
with:
65-
result-encoding: string
66-
# Look for the last version number, expecting it to be in the format:
67-
# `#.#.#-<suffix>.#` where the suffix is optional.
68-
script: |
69-
const message = process.env.COMMIT_MESSAGE;
70-
const regex = /^bump:.+(?<version>\d+\.\d+\.\d+[\da-z.-]*) \(#\d+\)$/m;
71-
const version = message.match(regex).groups.version;
72-
console.log(version);
73-
return version;
74-
- name: Bundle the module
75-
# We create an empty file first, so that tar doesn't complain about the
76-
# contents changing while it's running.
77-
run: |
78-
touch '${{ steps.module_name.outputs.name }}-${{ steps.version.outputs.result }}.tar.gz'
79-
tar \
80-
--exclude='.git' \
81-
--exclude='.gitignore' \
82-
--exclude='.github' \
83-
--exclude='.cz.yaml' \
84-
--exclude='*.tar.gz' \
85-
--exclude='*.tfvars' \
86-
--exclude='release.md' \
87-
--exclude='CODEOWNERS' \
88-
--exclude='trivy.yaml' \
89-
--exclude='*.env' \
90-
-czf '${{ steps.module_name.outputs.name }}-${{ steps.version.outputs.result }}.tar.gz' \
91-
.
92-
- name: Get changelog entry
93-
id: changelog
94-
uses: artlaman/conventional-changelog-reader-action@v1.1.0
95-
with:
96-
version: ${{ steps.version.outputs.result }}
97-
- name: Create release
98-
uses: softprops/action-gh-release@v2
99-
with:
100-
body: |
101-
## ${{ steps.changelog.outputs.version }} (${{ steps.changelog.outputs.date }})
102-
103-
${{ steps.changelog.outputs.changes }}
104-
tag_name: ${{ steps.version.outputs.result }}
105-
files: |
106-
${{ steps.module_name.outputs.name }}-${{ steps.version.outputs.result }}.tar.gz
39+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)