Skip to content

Commit 4cb27e3

Browse files
committed
first commit
0 parents  commit 4cb27e3

File tree

12,083 files changed

+1884614
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

12,083 files changed

+1884614
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "Workspace",
3+
"image": "ghcr.io/octodemo/container-nodejs-development:base-latest",
4+
"extensions": [
5+
"dbaeumer.vscode-eslint",
6+
"redhat.vscode-yaml",
7+
"swellaby.node-pack"
8+
],
9+
"postCreateCommand": "npm install"
10+
}

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# Indentation override for all JS under lib directory
12+
[**.js]
13+
indent_style = space
14+
indent_size = 2
15+
charset = utf-8

.eslintrc.cjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
commonjs: true,
5+
},
6+
plugins: ['deprecation', 'import', 'prettier', 'import'],
7+
extends: ['eslint:recommended', 'prettier', 'plugin:import/recommended'],
8+
parserOptions: {
9+
ecmaVersion: 'latest',
10+
sourceType: 'commonjs',
11+
},
12+
rules: {
13+
quotes: ['error', 'single', { avoidEscape: true }],
14+
'comma-dangle': ['error', 'always-multiline'],
15+
'comma-spacing': ['error', { before: false, after: true }],
16+
'no-multi-spaces': ['error', { ignoreEOLComments: false }],
17+
'array-bracket-newline': ['error', 'consistent'],
18+
'object-curly-spacing': ['error', 'always'],
19+
'array-bracket-spacing': ['error', 'never'],
20+
'object-curly-newline': ['error', { multiline: true, consistent: true }],
21+
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
22+
'keyword-spacing': ['error'],
23+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
24+
'space-before-blocks': 'error',
25+
curly: ['error', 'multi-line', 'consistent'],
26+
'no-bitwise': ['error'],
27+
'no-trailing-spaces': ['error'],
28+
'no-duplicate-imports': ['error'],
29+
'no-shadow': 'off',
30+
'no-use-before-define': 'off',
31+
'max-classes-per-file': ['error', 3],
32+
'no-underscore-dangle': 'off',
33+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
34+
indent: ['error', 2],
35+
'max-params': ['error', 5],
36+
},
37+
};

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Summary of changes

.github/renovate.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"extends": ["config:base"],
3+
"commitMessagePrefix": "Hotfix-0000/00/00 --",
4+
"packageRules": [
5+
{
6+
"matchPackagePatterns": ["*"],
7+
"matchUpdateTypes": ["major"],
8+
"reviewersFromCodeOwners": true,
9+
"addLabels": ["renovatebot", "major", "version-update"],
10+
"commitMessagePrefix": "Hotfix-0000/00/00 -- major",
11+
"groupName": "major"
12+
},
13+
{
14+
"matchPackagePatterns": ["*"],
15+
"matchUpdateTypes": ["minor"],
16+
"reviewersFromCodeOwners": true,
17+
"addLabels": ["renovatebot", "minor", "version-update"],
18+
"commitMessagePrefix": "Hotfix-0000/00/00 -- minor",
19+
"groupName": "minor"
20+
},
21+
{
22+
"matchPackagePatterns": ["*"],
23+
"matchUpdateTypes": ["patch"],
24+
"reviewersFromCodeOwners": true,
25+
"addLabels": ["renovatebot", "patch", "version-update"],
26+
"commitMessagePrefix": "Hotfix-0000/00/00 -- patch",
27+
"groupName": "patch"
28+
},
29+
{
30+
"matchPackagePatterns": ["*"],
31+
"matchUpdateTypes": ["pin", "digest"],
32+
"reviewersFromCodeOwners": true,
33+
"addLabels": ["renovatebot", "pin", "version-update"],
34+
"commitMessagePrefix": "Hotfix-0000/00/00 -- pin",
35+
"groupName": "pin"
36+
}
37+
],
38+
"vulnerabilityAlerts": {
39+
"commitMessagePrefix": "Hotfix-0000/00/00 -- Security update",
40+
"labels": ["security"]
41+
}
42+
}

.github/workflows/bump-version.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Bump version
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
deployments: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
cache: "npm"
22+
- run: |
23+
npm ci
24+
npm run build
25+
- name: Bump version and push tag
26+
id: tag_version
27+
uses: mathieudutour/github-tag-action@v6.0
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
release_branches: main
31+
pre_release_branches: dev
32+
- name: Create a GitHub release
33+
uses: ncipollo/release-action@v1
34+
with:
35+
tag: ${{ steps.tag_version.outputs.new_tag }}
36+
name: Release ${{ steps.tag_version.outputs.new_tag }}
37+
body: ${{ steps.tag_version.outputs.changelog }}
38+
generateReleaseNotes: true
39+
allowUpdates: true
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Tests this action failure by the application not being installed on the organisation
2+
3+
name: Test Failure - organisation - not installed
4+
5+
on:
6+
workflow_dispatch:
7+
8+
# One build per branch, cancel out of date builds only on pull requests
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
12+
13+
jobs:
14+
test_failure:
15+
runs-on: ubuntu-latest
16+
continue-on-error: true
17+
outputs:
18+
action_step_outcome: ${{ steps.use_action.outcome }}
19+
action_step_conclusion: ${{ steps.use_action.conclusion }}
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Use action
25+
id: use_action
26+
uses: ./
27+
with:
28+
application_id: ${{ secrets.APPLICATION_ID_NOT_INSTALLED }}
29+
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY_NOT_INSTALLED }}
30+
organization: CattleDip
31+
32+
validate_results:
33+
needs: test_failure
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Validate failure
37+
if: needs.test_failure.outputs.action_step_outcome != 'failure'
38+
run: |
39+
echo "Outcome: ${{ needs.test_failure.outputs.action_step_outcome }}"
40+
echo "Conclusion: ${{ needs.test_failure.outputs.action_step_conclusion }}"
41+
echo "Outcome should have been failure for an application that is not installed."
42+
exit 1
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Tests this action failure by the application not being installed on the repository
2+
3+
name: Test Failure - repository - not installed
4+
5+
on:
6+
workflow_dispatch:
7+
8+
# One build per branch, cancel out of date builds only on pull requests
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
12+
13+
jobs:
14+
test_failure:
15+
runs-on: ubuntu-latest
16+
continue-on-error: true
17+
outputs:
18+
action_step_outcome: ${{ steps.use_action.outcome }}
19+
action_step_conclusion: ${{ steps.use_action.conclusion }
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Use action
24+
id: use_action
25+
uses: ./
26+
with:
27+
application_id: ${{ secrets.APPLICATION_ID_NOT_INSTALLED }}
28+
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY_NOT_INSTALLED }}
29+
30+
validate_results:
31+
needs: test_failure
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Validate failure
35+
if: needs.test_failure.outputs.action_step_outcome != 'failure'
36+
run: |
37+
echo "Outcome: ${{ needs.test_failure.outputs.action_step_outcome }}"
38+
echo "Conclusion: ${{ needs.test_failure.outputs.action_step_conclusion }}"
39+
echo "Outcome should have been failure for an application that is not installed."
40+
exit 1
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Tests this action success by the application already being installed on an organisation
2+
3+
name: Test Success - organisation - installed
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
inputs:
11+
branch:
12+
description: The name of the branch to checkout for the action
13+
required: true
14+
default: main
15+
16+
# One build per branch, cancel out of date builds only on pull requests
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
20+
21+
jobs:
22+
test-installed-org:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout specified branch
26+
if: github.event_name == 'workflow_dispatch'
27+
uses: actions/checkout@v3
28+
with:
29+
ref: ${{ github.event.inputs.branch }}
30+
31+
- name: Checkout
32+
if: github.event_name != 'workflow_dispatch'
33+
uses: actions/checkout@v3
34+
35+
- name: Use action
36+
id: use_action
37+
uses: ./
38+
with:
39+
application_id: ${{ secrets.GHA_APPLICATION_ID }}
40+
application_private_key: ${{ secrets.GHA_APPLICATION_PRIVATE_KEY }}
41+
organization: CattleDip
42+
43+
- name: Use token to read details
44+
uses: actions/github-script@v2 #TODO: Update to v6
45+
with:
46+
github-token: ${{ steps.use_action.outputs.token }}
47+
script: |
48+
const repo = await github.repos.get({owner: 'CattleDip', repo: 'demo-gha-install-token'});
49+
console.log(JSON.stringify(repo, null, 2));
50+
51+
- name: Use token to checkout repository
52+
uses: actions/checkout@v3
53+
with:
54+
token: ${{ steps.use_action.outputs.token }}
55+
repository: CattleDip/demo-gha-install-token
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Tests this action success by the application already being installed on the repository
2+
3+
name: Test Success - repository - installed
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
inputs:
11+
branch:
12+
description: The name of the branch to checkout for the action
13+
required: true
14+
default: main
15+
16+
# One build per branch, cancel out of date builds only on pull requests
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
20+
21+
jobs:
22+
tested-installed-repo:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout specified branch
26+
if: github.event_name == 'workflow_dispatch'
27+
uses: actions/checkout@v3
28+
with:
29+
ref: ${{ github.event.inputs.branch }}
30+
31+
- name: Checkout
32+
if: github.event_name != 'workflow_dispatch'
33+
uses: actions/checkout@v3
34+
35+
- name: Use action
36+
id: use_action
37+
uses: ./
38+
with:
39+
application_id: ${{ secrets.GHA_APPLICATION_ID }}
40+
application_private_key: ${{ secrets.GHA_APPLICATION_PRIVATE_KEY }}
41+
42+
- name: Use token to read details
43+
uses: actions/github-script@v2 #TODO: Update to v6
44+
with:
45+
github-token: ${{ steps.use_action.outputs.token }}
46+
script: |
47+
const repo = await github.repos.get(context.repo);
48+
console.log(JSON.stringify(repo, null, 2));
49+
50+
- name: Use token to checkout repository
51+
uses: actions/checkout@v3
52+
with:
53+
token: ${{ steps.use_action.outputs.token }}
54+
repository: sammcj/demo-gha-install-token

0 commit comments

Comments
 (0)