Skip to content

Commit 7e495c7

Browse files
committed
Merge remote-tracking branch 'fork/main'
2 parents f26b6cb + 7578660 commit 7e495c7

13 files changed

+254
-40
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ VUE_APP_GITHUB_ORG=octodemo
1010

1111
VUE_APP_GITHUB_ENT=
1212

13+
# Determines the team name if exists to target API calls.
14+
VUE_APP_GITHUB_TEAM=
15+
1316
# Determines the GitHub Personal Access Token to use for API calls.
1417
# Create with scopes copilot, manage_billing:copilot or manage_billing:enterprise, read:enterprise AND read:org
1518
VUE_APP_GITHUB_TOKEN=

.github/workflows/azure-static-web-apps-ashy-sky-02a7d0403.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
name: Azure Static Web Apps CI/CD
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
types: [opened, synchronize, reopened, closed]
9-
branches:
10-
- main
4+
workflow_dispatch:
5+
116

127
jobs:
138
build_and_deploy_job:

.github/workflows/deploy_to_ghcr.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and push Docker image
1+
name: Build, push Docker image and deploy to Azure
22

33
on:
44
push:
@@ -32,4 +32,21 @@ jobs:
3232
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:latest .
3333
docker push ghcr.io/$GITHUB_REPO:latest
3434
env:
35-
GITHUB_REPO: ${{ github.repository }}
35+
GITHUB_REPO: ${{ github.repository }}
36+
37+
deploy:
38+
runs-on: ubuntu-latest
39+
needs: push_to_ghcr
40+
environment:
41+
name: 'production'
42+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
43+
44+
steps:
45+
- name: Deploy to Azure Web App
46+
id: deploy-to-webapp
47+
uses: azure/webapps-deploy@v2
48+
with:
49+
app-name: 'copilot-metrics-viewer'
50+
slot-name: 'production'
51+
publish-profile: ${{ secrets.AzureAppService_PublishProfile_e94dfd38811a421eafe5ce4eee13b68b }}
52+
images: 'ghcr.io/github-copilot-resources/copilot-metrics-viewer:latest'
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and push Docker image with custom tag
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag for the Docker image'
8+
required: true
9+
default: 'latest'
10+
11+
permissions:
12+
packages: write
13+
14+
jobs:
15+
push_to_ghcr:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout GitHub Action
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # Fetch all history for all tags and branches
22+
23+
- name: Checkout specific tag
24+
run: git checkout tags/v${{ github.event.inputs.tag }}
25+
26+
- name: Login to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Build and Push Docker Image
34+
run: |
35+
GITHUB_REPO="${GITHUB_REPO,,}" # convert repo name to lowercase as required by docker
36+
TAG=${{ github.event.inputs.tag }}
37+
echo "building docker image in repository '$GITHUB_REPO' with tag '$TAG' ..."
38+
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:$TAG .
39+
docker push ghcr.io/$GITHUB_REPO:$TAG
40+
env:
41+
GITHUB_REPO: ${{ github.repository }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and push Docker image with release tag
2+
3+
on:
4+
5+
release:
6+
types:
7+
- published
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
permissions:
13+
packages: write
14+
15+
jobs:
16+
push_to_ghcr:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout GitHub Action
20+
uses: actions/checkout@v4
21+
22+
- name: Get Latest Release Tag
23+
id: get_latest_release
24+
uses: actions/github-script@v6
25+
with:
26+
script: |
27+
const latestRelease = await github.rest.repos.getLatestRelease({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
});
31+
core.setOutput('tag_name', latestRelease.data.tag_name);
32+
33+
- name: Login to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Build and Push Docker Image
41+
run: |
42+
GITHUB_REPO="${GITHUB_REPO,,}" # convert repo name to lowercase as required by docker
43+
TAG=${{ steps.get_latest_release.outputs.result }}
44+
echo "building docker image in repository '$GITHUB_REPO' with tag '$TAG' ..."
45+
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:$TAG .
46+
docker push ghcr.io/$GITHUB_REPO:$TAG
47+
env:
48+
GITHUB_REPO: ${{ github.repository }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy container app to Azure Web App - copilot-metrics-viewer
5+
6+
on:
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
12+
deploy:
13+
runs-on: ubuntu-latest
14+
environment:
15+
name: 'production'
16+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
17+
18+
steps:
19+
- name: Deploy to Azure Web App
20+
id: deploy-to-webapp
21+
uses: azure/webapps-deploy@v2
22+
with:
23+
app-name: 'copilot-metrics-viewer'
24+
slot-name: 'production'
25+
publish-profile: ${{ secrets.AzureAppService_PublishProfile_e94dfd38811a421eafe5ce4eee13b68b }}
26+
images: 'ghcr.io//${{ secrets.AzureAppService_ContainerUsername_6e6399ab4c2848209c95dce8fff002f0 }}/github-copilot-resources/copilot-metrics-viewer:${{ github.sha }}'

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The language breakdown analysis tab also displays a table showing the Accepted P
7474
<p align="center">
7575
<img width="800" alt="image" src="https://github.com/github-copilot-resources/copilot-metrics-viewer/assets/54096296/51747194-df30-4bfb-8849-54a0510fffcb">
7676
</p>
77+
7778
1. **Total Assigned:** This metric represents the total number of Copilot seats assigned within current organization/enterprise.
7879

7980
2. **Assigned But Never Used:** This metric shows seats that were assigned but never used within the current organization/enterprise. The assigned timestamp is also displayed in the chart.
@@ -103,7 +104,15 @@ VUE_APP_GITHUB_ORG= <YOUR-ORGANIZATION>
103104
104105
VUE_APP_GITHUB_ENT=
105106
````
107+
#### VUE_APP_GITHUB_TEAM
108+
109+
The `VUE_APP_GITHUB_TEAM` environment variable filters metrics for a specific GitHub team within an Enterprise or Organization account.
110+
‼️ Important ‼️ When this variable is set, all displayed metrics will pertain exclusively to the specified team. To view metrics for the entire Organization or Enterprise, remove this environment variable.
106111

112+
````
113+
VUE_APP_GITHUB_TEAM=
114+
115+
````
107116

108117
#### VUE_APP_MOCKED_DATA
109118

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"@mdi/font": "5.9.55",
12-
"axios": "^1.6.2",
12+
"axios": "^1.7.4",
1313
"chart.js": "^4.4.1",
1414
"core-js": "^3.8.3",
1515
"postcss": "^8.4.31",

public/assets/app-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ window._ENV_ = {
66
VUE_APP_GITHUB_ENT: "${VUE_APP_GITHUB_ENT}",
77
VUE_APP_GITHUB_TOKEN: "${VUE_APP_GITHUB_TOKEN}",
88
VUE_APP_GITHUB_API: "${VUE_APP_GITHUB_API}",
9+
VUE_APP_GITHUB_TEAM: "${VUE_APP_GITHUB_TEAM}",
910
};
1011

1112
if(window._ENV_.VUE_APP_GITHUB_TOKEN) {

0 commit comments

Comments
 (0)