generated from UK-Export-Finance/nestjs-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(github-actions): enable various imperative github actions (#847)
## Introduction ✏️ Ensure various imperative pipelines are available for consistent pipeline actions across all the applications. ## Resolution ✔️ * Added `github.yml` for PR lint check. * Added `prettier:all` check to `lint.yml`. * Added `pr.yml` check for stale PR validation. * Updated `publish.yml` as per latest `Google Release please` release notes. ## Miscellaneous ➕ * Dependencies updates * Moved GHA hardcoded variables to Enterprise scope GH secrets / variable * Refactored GitHooks --------- Co-authored-by: Abhi Markan <amarkan@ukexportfinance.gov.uk>
- Loading branch information
1 parent
93a9a91
commit fbfafa9
Showing
13 changed files
with
292 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# This GitHub Actions workflow ensures that any pull request targeting the main or main-* | ||
# branches meets certain criteria before it is merged. The workflow sets up the necessary infrastructure, | ||
# configures the environment, and performs checks on the pull request title, body, labels | ||
# and assignee to ensure that it adheres to predefined standards. If any of these checks fail, | ||
# the workflow will exit with an error, preventing the pull request from proceeding. | ||
|
||
name: GitHub | ||
run-name: 🔬 Pull request inspection on ${{ github.event.number }} | ||
|
||
on: | ||
pull_request: | ||
branches: [main, main-*] | ||
|
||
env: | ||
environment: "qa" | ||
timezone: ${{ vars.TIMEZONE }} | ||
|
||
jobs: | ||
# 1. Setup test infrastructure | ||
setup: | ||
name: Infrastructure setup 🔧 | ||
runs-on: ubuntu-latest | ||
outputs: | ||
environment: ${{ env.environment }} | ||
timezone: ${{ env.timezone }} | ||
steps: | ||
- name: Environment 🧪 | ||
run: echo "Environment set to ${{ env.environment }}" | ||
|
||
- name: Timezone 🌐 | ||
run: echo "Timezone set to ${{ env.timezone }}" | ||
|
||
# 2. Pull request | ||
pullrequest: | ||
name: Pull request ⬇️ | ||
needs: setup | ||
environment: | ||
name: ${{ needs.setup.outputs.environment }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Timezone | ||
uses: szenius/set-timezone@v1.2 | ||
with: | ||
timezoneLinux: ${{ needs.setup.outputs.timezone }} | ||
|
||
- name: Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ vars.NODE_VERSION }} | ||
|
||
- name: Dependencies | ||
working-directory: ./ | ||
run: npm ci --legacy-peer-deps | ||
|
||
- name: Title | ||
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --color --verbose $1 | ||
|
||
- name: Body | ||
if: ${{ github.event.pull_request.body == '' }} | ||
run: exit 1 | ||
|
||
- name: Label | ||
if: ${{ github.event.pull_request.labels == '[]' }} | ||
run: exit 1 | ||
|
||
- name: Assignee | ||
if: ${{ github.event.pull_request.assignee == '[]' }} | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# This YAML configuration defines a GitHub Actions workflow named "PR" designed to analyse pull requests | ||
# for staleness and take action accordingly. | ||
# | ||
# Identify: Uses the actions/stale@v5 action with parameters to mark pull requests as stale if | ||
# they have been inactive for a certain number of days and close them if they exceed another threshold. | ||
# This workflow helps maintain the health of the pull request queue by identifying and managing stale pull requests automatically. | ||
# | ||
|
||
name: PR | ||
run-name: 🔎 Pull request analysis on ${{ github.event.number }} | ||
|
||
on: | ||
schedule: | ||
- cron: "00 00 * * *" | ||
env: | ||
environment: "qa" | ||
timezone: ${{ vars.TIMEZONE }} | ||
|
||
jobs: | ||
# 1. Setup test infrastructure | ||
setup: | ||
name: Infrastructure setup 🔧 | ||
runs-on: ubuntu-latest | ||
outputs: | ||
environment: ${{ env.environment }} | ||
timezone: ${{ env.timezone }} | ||
steps: | ||
- name: Environment 🧪 | ||
run: echo "Environment set to ${{ env.environment }}" | ||
|
||
- name: Timezone 🌐 | ||
run: echo "Timezone set to ${{ env.timezone }}" | ||
|
||
# 2. Identify stale PRs | ||
stale: | ||
name: Stale 📅 | ||
needs: setup | ||
environment: | ||
name: ${{ needs.setup.outputs.environment }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Identify | ||
uses: actions/stale@v9 | ||
with: | ||
days-before-pr-stale: ${{ vars.STALE_PR_DAYS }} | ||
stale-pr-message: "Pull request marked as stale due to inactivity." | ||
stale-pr-label: "Stale" | ||
days-before-pr-close: ${{ vars.CLOSE_PR_DAYS }} | ||
close-pr-message: "Pull request has been closed due to inactivity." | ||
close-pr-label: "Closed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit $1 | ||
npx lint-staged | ||
npx commitlint --color --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
# Root | ||
node_modules/ | ||
dist/ | ||
.cache/ | ||
build/ | ||
public/ | ||
generated_reports/ | ||
coverage/ | ||
package*.json | ||
.cache | ||
|
||
# Sub-directories | ||
**/node_modules/ | ||
**/dist/ | ||
**/build/ | ||
**/public/ | ||
**/generated_reports/ | ||
**/coverage/ | ||
**/node_modules/** | ||
/node_modules | ||
/package-lock.json | ||
**/package*.json | ||
**/.cache |
Oops, something went wrong.