Skip to content

Commit

Permalink
feat: Typescript port of lucacome/docker-image-update-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
halostatue committed Jul 29, 2024
0 parents commit 9acf4e3
Show file tree
Hide file tree
Showing 27 changed files with 1,235 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf

dist/** -diff linguist-generated=true
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @KineticCafe/actions
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
time: '10:00'
timezone: 'America/Toronto'
commit-message:
prefix: chore
groups:
pnpm-dev:
applies-to: version-updates
dependency-type: development
update-types:
- minor
- patch
exclude-patterns:
- '@biomejs/biome'

pnpm-prod:
applies-to: version-updates
dependency-type: production
update-types:
- minor
- patch

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
time: '10:00'
timezone: 'America/Toronto'
commit-message:
prefix: chore
groups:
actions:
applies-to: version-updates
patterns:
- '*'
update-types:
- minor
- patch
57 changes: 57 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript

on:
push:
pull_request:
merge_group:
workflow_dispatch:

permissions:
contents: read

jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/[email protected]
with:
node-version: 20.x
cache: pnpm

- run: pnpm install --frozen-lockfile

- run: |
pnpm run all
# This will fail the workflow if the PR wasn't created by Dependabot.
- name: Compare Directories
run: |
if [[ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt 0 ]]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --text --ignore-space-at-eol dist/
exit 1
fi
id: diff

# If `dist/` was different than expected, and this was not a Dependabot
# PR, upload the expected version as a workflow artifact.
- uses: actions/upload-artifact@v4
if: ${{ steps.diff.outcome == 'failure' }}
with:
name: dist
path: dist/
89 changes: 89 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '37 10 * * 1'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: [ 'javascript-typescript' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Ignore dist because it is packaged by ncc and we have no control over that.
# Using an in-line configuration.
config: |
paths-ignore:
- dist
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
14 changes: 14 additions & 0 deletions .github/workflows/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check DCO

on:
pull_request:

jobs:
check-dco:
runs-on: ubuntu-latest
steps:
- uses: KineticCafe/[email protected]
with:
exempt-authors: |
@kineticcommerce.com
@kineticcafe.com
17 changes: 17 additions & 0 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Dependabot auto-merge

on:
pull_request:

permissions:
contents: write
pull-requests: write

jobs:
dependabot-automerge:
runs-on: ubuntu-latest

steps:
- uses: KineticCafe/actions/[email protected]
with:
update-type: minor
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules/
logs
*.log*
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
.npm
.eslintcache
.node_repl_history
*.tgz
.DS_Store
Thumbs.db
__tests__/runner/*
lib/
2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "20"
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# KineticCafe/docker-image-update-checker Changelog

## 1.0 / 2024-07-31

- Initial release. This is a port of lucacome/docker-image-update-checker to
Typescript.
35 changes: 35 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributing

We value contributions to @KineticCafe/docker-image-update-checker: bug reports,
feature requests, and code contributions.

Before contributing patches, please read the [Licence.md](./Licence.md).

@KineticCafe/docker-image-update-checker reports is governed under the Kinetic
Commerce Open Source [Code of Conduct][].

## Code Guidelines

Our usual code contribution guidelines apply:

- Code changes _will not_ be accepted without tests. The test suite is written
with [vitest][].
- Match our coding style. We use Biome to assist with this.
- Use a thoughtfully-named topic branch that contains your change. Rebase your
commits into logical chunks as necessary.
- Use [quality commit messages][].
- The version number must not be changed except as part of the release process.
- Submit a pull request with your changes.
- New or changed behaviours require new or updated documentation.

A pull request will be accepted only if all code quality checks performed in
GitHub Actions pass.

@KineticCafe/docker-image-update-checker-reports is compiled into a single file
with `@vercel/ncc` for release. One of the status checks is that there are no
changes during the packaging process. Ensure that you run `pnpm all` and commit
any files in `dist/` once you are satisfied with your changes.

[code of conduct]: https://github.com/KineticCafe/code-of-conduct
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[vitest]: https://vitest.dev/
28 changes: 28 additions & 0 deletions Licence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Licence

@KineticCafe/docker-image-update-checker is copyright © 2024 Kinetic Commerce
and contributors under the [MIT license][mit-license], except:

- The copies of the MIT License and the Developer Certificate of Origin in
`licenses/`.

## Developer Certificate of Origin

All contributors **must** certify they are able and willing to provide their
contributions under the terms of this project's licences with the certification
of the [Developer Certificate of Origin (Version 1.1)][dco].

Such certification is provided by ensuring that the following line must be
included as the last line of a commit message for every commit contributed:

Signed-off-by: FirstName LastName <[email protected]>

The `Signed-off-by` line can be automatically added by git with the `-s` or
`--signoff` option on `git commit`:

```sh
git commit --signoff
```

[mit-license]: licenses/MIT.txt
[dco]: licenses/dco.txt
Loading

0 comments on commit 9acf4e3

Please sign in to comment.