Skip to content

Commit 577f940

Browse files
committed
get repos from one place
1 parent 0efc577 commit 577f940

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

.github/workflows/build_multi_arch_image.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ jobs:
3131
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
3232
with:
3333
node-version-file: .tool-versions
34+
- name: Generate a token to get details from other repositories
35+
id: generate-token
36+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf
37+
with:
38+
app-id: ${{ vars.EPS_REPO_STATUS_APP_ID }}
39+
private-key: ${{ secrets.EPS_REPO_STATUS_PEM }}
40+
owner: "NHSDigital"
41+
3442
- name: make install
3543
run: |
3644
make install-node
@@ -45,6 +53,7 @@ jobs:
4553
GH_TOKEN: '${{ github.token }}'
4654
ARCHITECTURE: '${{ matrix.arch }}'
4755
DOCKER_TAG: '${{ inputs.docker_tag }}'
56+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
4857
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
4958
name: Upload docker images
5059
with:

scripts/generate_language_version_files.sh

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
11
#!/usr/bin/env bash
2+
set -e
23

34
# Get the current directory of the script
45
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
56
LANGUAGE_VERSIONS_DIR="${SCRIPT_DIR}/../src/base/.devcontainer/language_versions"
67

7-
# Define repositories to fetch .tool-versions from
8-
REPOS=(
9-
"NHSDigital/electronic-prescription-service-clinical-prescription-tracker"
10-
"NHSDigital/prescriptionsforpatients"
11-
"NHSDigital/prescriptions-for-patients"
12-
"NHSDigital/electronic-prescription-service-api"
13-
"NHSDigital/electronic-prescription-service-release-notes"
14-
"NHSDigital/electronic-prescription-service-account-resources"
15-
"NHSDigital/eps-prescription-status-update-api"
16-
"NHSDigital/eps-FHIR-validator-lambda"
17-
"NHSDigital/eps-load-test"
18-
"NHSDigital/eps-prescription-tracker-ui"
19-
"NHSDigital/eps-aws-dashboards"
20-
"NHSDigital/eps-cdk-utils"
21-
"NHSDigital/eps-vpc-resources"
22-
"NHSDigital/eps-assist-me"
23-
"NHSDigital/validation-service-fhir-r4"
24-
"NHSDigital/electronic-prescription-service-get-secrets"
25-
"NHSDigital/nhs-fhir-middy-error-handler"
26-
"NHSDigital/nhs-eps-spine-client"
27-
"NHSDigital/electronic-prescription-service-api-regression-tests"
28-
"NHSDigital/eps-common-workflows"
29-
"NHSDigital/eps-storage-terraform"
30-
"NHSDigital/eps-spine-shared"
31-
)
8+
# Check if the user is logged in with GitHub CLI
9+
if ! gh auth status > /dev/null 2>&1; then
10+
echo "You are not logged in to GitHub CLI. Initiating login..."
11+
gh auth login
12+
fi
3213

14+
# Fetch the repos.json file from the eps-repo-status repository using GitHub CLI
15+
REPOS_JSON_PATH="repos/NHSDigital/eps-repo-status/contents/packages/get_repo_status/app/repos.json"
16+
TEMP_REPOS_JSON="/tmp/repos.json"
17+
18+
# Download the repos.json file
19+
if ! gh api -H 'Accept: application/vnd.github.v3.raw' "$REPOS_JSON_PATH" > "$TEMP_REPOS_JSON"; then
20+
echo "Failed to fetch repos.json using GitHub CLI. Exiting."
21+
exit 1
22+
fi
23+
24+
# Parse the repoUrl values from the JSON file
25+
mapfile -t REPOS < <(jq -r '.[].repoUrl' "$TEMP_REPOS_JSON")
3326

3427
# Define output files
3528
mkdir -p "${LANGUAGE_VERSIONS_DIR}"

0 commit comments

Comments
 (0)