Skip to content

Commit

Permalink
Merge pull request #1 from peter-murray/main
Browse files Browse the repository at this point in the history
Update to latest
  • Loading branch information
ksabr authored Nov 1, 2024
2 parents 014a612 + 8f7fb6a commit 03913c6
Show file tree
Hide file tree
Showing 40 changed files with 2,956 additions and 1,199 deletions.
19 changes: 12 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"name": "Workspace",
"image": "ghcr.io/octodemo/container-nodejs-development:base-latest",
"extensions": [
"dbaeumer.vscode-eslint",
"redhat.vscode-yaml",
"swellaby.node-pack"
],
"postCreateCommand": "npm install"
"image": "ghcr.io/octodemo/development-containers/javascript-nodejs-20:base-202408-r2",
"postCreateCommand": "npm install",
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"redhat.vscode-yaml",
"swellaby.node-pack",
"vitest.explorer"
],
}
}
}
18 changes: 9 additions & 9 deletions .github/workflows/test_failure_organization_not_installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ jobs:
test_failure:
runs-on: ubuntu-latest
continue-on-error: true

outputs:
action_step_outcome: ${{ steps.use_action.outcome }}
action_step_conclusion: ${{ steps.use_action.conclusion }}

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use action
uses: actions/checkout@v4

- name: Use action
id: use_action
uses: ./
with:
application_id: ${{ secrets.APPLICATION_ID_NOT_INSTALLED }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY_NOT_INSTALLED }}
organization: devopsventures

validate_results:
needs: test_failure
runs-on: ubuntu-latest

runs-on: ubuntu-latest

steps:
- name: Validate failure
if: needs.test_failure.outputs.action_step_outcome != 'failure'
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test_failure_repository_not_installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ jobs:
test_failure:
runs-on: ubuntu-latest
continue-on-error: true

outputs:
action_step_outcome: ${{ steps.use_action.outcome }}
action_step_conclusion: ${{ steps.use_action.conclusion }}

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use action
uses: actions/checkout@v4

- name: Use action
id: use_action
uses: ./
with:
application_id: ${{ secrets.APPLICATION_ID_NOT_INSTALLED }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY_NOT_INSTALLED }}

validate_results:
needs: test_failure
runs-on: ubuntu-latest

runs-on: ubuntu-latest

steps:
- name: Validate failure
if: needs.test_failure.outputs.action_step_outcome != 'failure'
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/test_organization_installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@ name: Test Success - organization - installed
on:
push:
workflow_dispatch:
inputs:
branch:
description: The name of the branch to checkout for the action
required: true
default: main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout specified branch
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout
uses: actions/checkout@v2

- name: Use action
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4

- name: Use action
id: use_action
uses: ./
with:
Expand All @@ -23,9 +35,9 @@ jobs:
organization: octodemo

- name: Use token to read details
uses: actions/github-script@v2
uses: actions/github-script@v7
with:
github-token: ${{ steps.use_action.outputs.token }}
script: |
const repo = await github.repos.get({owner: 'octodemo', repo: 'demo-bootstrap'});
const repo = await github.rest.repos.get({owner: 'octodemo', repo: 'bootstrap'});
console.log(JSON.stringify(repo, null, 2));
44 changes: 44 additions & 0 deletions .github/workflows/test_organization_installed_revocation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Tests this action success by the application already being installed on an organization

name: Test Success - organization - installed with revocation

on:
push:
workflow_dispatch:
inputs:
branch:
description: The name of the branch to checkout for the action
required: true
default: main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout specified branch
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4

- name: Use action
id: use_action
uses: ./
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
organization: octodemo
revoke_token: true

- name: Use token to read details
uses: actions/github-script@v7
with:
github-token: ${{ steps.use_action.outputs.token }}
script: |
const repo = await github.rest.repos.get({owner: 'octodemo', repo: 'bootstrap'});
console.log(JSON.stringify(repo, null, 2));
18 changes: 15 additions & 3 deletions .github/workflows/test_repository_installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@ name: Test Success - repository - installed
on:
push:
workflow_dispatch:
inputs:
branch:
description: The name of the branch to checkout for the action
required: true
default: main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout specified branch
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout
uses: actions/checkout@v2
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4

- name: Use action
id: use_action
Expand All @@ -22,9 +34,9 @@ jobs:
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}

- name: Use token to read details
uses: actions/github-script@v2
uses: actions/github-script@v7
with:
github-token: ${{ steps.use_action.outputs.token }}
script: |
const repo = await github.repos.get(context.repo);
const repo = await github.rest.repos.get(context.repo);
console.log(JSON.stringify(repo, null, 2));
6 changes: 3 additions & 3 deletions .github/workflows/test_repository_installed_limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

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

- name: Use action
id: use_action
Expand All @@ -23,9 +23,9 @@ jobs:
permissions: issues:read, actions:write

- name: Use token to read details
uses: actions/github-script@v2
uses: actions/github-script@v7
with:
github-token: ${{ steps.use_action.outputs.token }}
script: |
const repo = await github.repos.get(context.repo);
const repo = await github.rest.repos.get(context.repo);
console.log(JSON.stringify(repo, null, 2));
69 changes: 69 additions & 0 deletions .github/workflows/test_repository_installed_proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Tests this action success by the application already being installed on the repository

name: Test Success - repository - installed - with proxy

on:
push:
workflow_dispatch:
inputs:
branch:
description: The name of the branch to checkout for the action
required: true
default: main

jobs:
test:
runs-on: ubuntu-latest

# services:
# squid:
# image: ubuntu/squid
# ports:
# - 3128/tcp
# volumes:
# - '${{ github.workspace }}:/var/log/squid'
# options: --dns 8.8.8.8

steps:
- name: Checkout specified branch
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4

- name: Start Squid Proxy container
run: |
mkdir ${{ github.workspace }}/squid
sudo chown proxy:proxy ${{ github.workspace }}/squid
docker run -dit --name squid -p 3128:3128 -v ${{ github.workspace }}/test/squid.conf:/etc/squid/squid.conf -v ${{ github.workspace }}/squid:/var/log/squid ubuntu/squid:latest
sleep 5
docker logs squid
docker inspect squid
curl http://localhost:3128
- name: Use action
id: use_action
continue-on-error: true
uses: ./
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
https_proxy: http://localhost:3128

- name: Show Squid Logs and stop container
run: |
docker stop squid
ls -la ${{ github.workspace }}/squid
sudo cat ${{ github.workspace }}/squid/access.log
- name: Use token to read details
uses: actions/github-script@v7
with:
github-token: ${{ steps.use_action.outputs.token }}
script: |
const repo = await github.rest.repos.get(context.repo);
console.log(JSON.stringify(repo, null, 2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Tests this action success by the application already being installed on the repository

name: Test Success - repository - installed - with proxy - ignored

on:
push:
workflow_dispatch:
inputs:
branch:
description: The name of the branch to checkout for the action
required: true
default: main

jobs:
test:
runs-on: ubuntu-latest

# services:
# squid:
# image: ubuntu/squid
# ports:
# - 3128/tcp
# volumes:
# - '${{ github.workspace }}:/var/log/squid'
# options: --dns 8.8.8.8

steps:
- name: Checkout specified branch
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4

- name: Start Squid Proxy container
run: |
mkdir ${{ github.workspace }}/squid
sudo chown proxy:proxy ${{ github.workspace }}/squid
docker run -dit --name squid -p 3128:3128 -v ${{ github.workspace }}/test/squid.conf:/etc/squid/squid.conf -v ${{ github.workspace }}/squid:/var/log/squid ubuntu/squid:latest
sleep 5
docker logs squid
docker inspect squid
curl http://localhost:3128
- name: Use action
id: use_action
continue-on-error: true
uses: ./
env:
HTTPS_PROXY: http://localhost:3128
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
ignore_environment_proxy: true

- name: Show Squid Logs and stop container
run: |
docker stop squid
ls -la ${{ github.workspace }}/squid
echo "Access Logs:"
sudo cat ${{ github.workspace }}/squid/access.log
- name: Use token to read details
uses: actions/github-script@v7
with:
github-token: ${{ steps.use_action.outputs.token }}
script: |
const repo = await github.rest.repos.get(context.repo);
console.log(JSON.stringify(repo, null, 2));
Loading

0 comments on commit 03913c6

Please sign in to comment.