Skip to content

Commit

Permalink
Created the .NET Library CodeQL composite Action
Browse files Browse the repository at this point in the history
  • Loading branch information
ashneilson committed Dec 21, 2022
1 parent 68baf41 commit 1b11e68
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "07:00"
timezone: "Pacific/Auckland"
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Action Name
name: Automated Releases

# Controls when the action will run
on:
push:
tags:
- 'v*.*.*'

# Workflow Jobs
jobs:
# Build Job
build:
runs-on: ubuntu-latest
steps:
# Step 1 - Checkout Code
- name: Checkout Code
uses: actions/checkout@v3

# Step 2 - Extract Environment Variables
- name: Extract Environment Variables
uses: FranzDiebold/github-env-vars-action@v2

# Step 3 - Generate the Changelog
- name: Generate the Changelog
id: changelog
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: metcalfc/changelog-generator@v4.0.1
with:
myToken: ${{ secrets.GITHUB_TOKEN }}

# Step 4 - Create GitHub Release
- name: Create GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CI_REF_NAME }}
name: Release ${{ env.CI_REF_NAME }}
body: |
${{ steps.changelog.outputs.changelog }}
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# dotnet-library-codeql-action
# .NET Library CodeQL Action
A Composite Action that runs CodeQL to Analyze a .NET 6/7 Library

## Inputs

### `private-nuget-url`

**Required** The URL of the Private NuGet Repository (e.g. https://nuget.pkg.github.com/myname/index.json)

### `private-nuget-token`

**Required** The Token used for Authentication with the Private NuGet Repository

## Example Usage

```yml
uses: ricado-group/dotnet-library-codeql-action@v1
with:
private-nuget-url: 'https://nuget.pkg.github.com/myname/index.json'
private-nuget-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
```
## Stay Updated with Dependabot
Use [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot) to update your GitHub Actions by creating a `.github/dependabot.yml` file:

```yaml
version: 2
updates:
# Maintain Dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
```
44 changes: 44 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: '.NET Library CodeQL'
description: 'A Composite Action that runs CodeQL to Analyze a .NET 6/7 Library'
author: 'RICADO Group'
branding:
icon: 'link'
color: 'blue'

# Inputs
inputs:
private-nuget-url:
description: 'The URL of the Private NuGet Repository (e.g. https://nuget.pkg.github.com/myname/index.json)'
required: true
private-nuget-token:
description: 'The Token used for Authentication with the Private NuGet Repository'
required: true

runs:
using: 'composite'
steps:
# Step 1 - Initialize CodeQL
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: csharp
queries: security-and-quality

# Step 2 - Setup .NET 6 & 7 with GitHub Packages Authentication
- name: Setup .NET 6 with GitHub Packages Authentication
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
source-url: ${{ inputs.private-nuget-url }}
env:
NUGET_AUTH_TOKEN: ${{ inputs.private-nuget-token }}

# Step 3 - Build the Library
- name: Run CodeQL Autobuild
uses: github/codeql-action/autobuild@v2

# Step 4 - Perform CodeQL Analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

0 comments on commit 1b11e68

Please sign in to comment.