From d7772fbac4befcfa6fc3fc484a96cf2ad738ac0f Mon Sep 17 00:00:00 2001 From: rory Date: Mon, 10 Jun 2024 16:36:34 -0700 Subject: [PATCH 1/4] Upgrade mock-github --- package-lock.json | 51 ++++++++--------------------------------------- package.json | 2 +- 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/package-lock.json b/package-lock.json index b2a5b377b281..675c698986fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@gorhom/portal": "^1.0.14", "@invertase/react-native-apple-authentication": "^2.2.2", "@kie/act-js": "^2.6.0", - "@kie/mock-github": "^1.0.0", + "@kie/mock-github": "2.0.1", "@onfido/react-native-sdk": "10.6.0", "@react-native-camera-roll/camera-roll": "7.4.0", "@react-native-clipboard/clipboard": "^1.13.2", @@ -7051,48 +7051,12 @@ "act-js": "bin/act" } }, - "node_modules/@kie/act-js/node_modules/@kie/mock-github": { - "version": "2.0.0", - "license": "SEE LICENSE IN LICENSE", - "dependencies": { - "@octokit/openapi-types-ghec": "^18.0.0", - "ajv": "^8.11.0", - "express": "^4.18.1", - "fast-glob": "^3.2.12", - "fs-extra": "^10.1.0", - "nock": "^13.2.7", - "simple-git": "^3.8.0", - "totalist": "^3.0.0" - } - }, - "node_modules/@kie/act-js/node_modules/@octokit/openapi-types-ghec": { - "version": "18.1.1", - "license": "MIT" - }, - "node_modules/@kie/act-js/node_modules/fs-extra": { - "version": "10.1.0", - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@kie/act-js/node_modules/totalist": { - "version": "3.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/@kie/mock-github": { - "version": "1.1.0", - "license": "SEE LICENSE IN LICENSE", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@kie/mock-github/-/mock-github-2.0.1.tgz", + "integrity": "sha512-G1FD/jg1KyW7a6NvKI4uEVJCK3eJnzXkh4Ikxn2is5tiNC980lavi8ak6bn1QEFEgpYcfM4DpZM3yHDfOmyLuQ==", "dependencies": { - "@octokit/openapi-types-ghec": "^14.0.0", + "@octokit/openapi-types-ghec": "^18.0.0", "ajv": "^8.11.0", "express": "^4.18.1", "fast-glob": "^3.2.12", @@ -7542,8 +7506,9 @@ "license": "MIT" }, "node_modules/@octokit/openapi-types-ghec": { - "version": "14.0.0", - "license": "MIT" + "version": "18.1.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types-ghec/-/openapi-types-ghec-18.1.1.tgz", + "integrity": "sha512-5Ri7FLYX4gJSdG+G0Q8QDca/gOLfkPN4YR2hkbVg6hEL+0N62MIsJPTyNaT9pGEXCLd1KbYV6Lh3T2ggsmyBJw==" }, "node_modules/@octokit/plugin-paginate-rest": { "version": "3.1.0", diff --git a/package.json b/package.json index 058406cf369d..ebbf0725fd7a 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "@gorhom/portal": "^1.0.14", "@invertase/react-native-apple-authentication": "^2.2.2", "@kie/act-js": "^2.6.0", - "@kie/mock-github": "^1.0.0", + "@kie/mock-github": "2.0.1", "@onfido/react-native-sdk": "10.6.0", "@react-native-camera-roll/camera-roll": "7.4.0", "@react-native-clipboard/clipboard": "^1.13.2", From 943e6dc2d637a72904698a4457d960b74beb1fed Mon Sep 17 00:00:00 2001 From: rory Date: Mon, 10 Jun 2024 16:37:01 -0700 Subject: [PATCH 2/4] Log into github docker registry --- .github/workflows/testGithubActionsWorkflows.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/testGithubActionsWorkflows.yml b/.github/workflows/testGithubActionsWorkflows.yml index d052b343cf0c..51672a07432e 100644 --- a/.github/workflows/testGithubActionsWorkflows.yml +++ b/.github/workflows/testGithubActionsWorkflows.yml @@ -28,6 +28,9 @@ jobs: - name: Install Act run: brew install act + - name: Log into GitHub Container Registry + run: docker login ghcr.io -u OSBotify -p ${{ secrets.OS_BOTIFY_TOKEN }} + - name: Set ACT_BINARY run: echo "ACT_BINARY=$(which act)" >> "$GITHUB_ENV" From e70f69b5d4c9001840d01f8ad7bca80957b78782 Mon Sep 17 00:00:00 2001 From: rory Date: Mon, 10 Jun 2024 16:37:16 -0700 Subject: [PATCH 3/4] Specify archicture if running locally --- workflow_tests/utils/ExtendedAct.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/workflow_tests/utils/ExtendedAct.ts b/workflow_tests/utils/ExtendedAct.ts index e2bb12ec8e01..45450113f8b8 100644 --- a/workflow_tests/utils/ExtendedAct.ts +++ b/workflow_tests/utils/ExtendedAct.ts @@ -2,6 +2,7 @@ // This eslint-disable comment is here to allow accessing private properties in the Act class import type {RunOpts, Step, Workflow} from '@kie/act-js'; import {Act} from '@kie/act-js'; +import os from 'os'; import path from 'path'; import JobMocker from './JobMocker'; import type {MockJobs} from './JobMocker'; @@ -23,6 +24,10 @@ class ExtendedAct extends Act { actArguments.push('--actor', opts.actor); } + if (os.arch() === 'arm64') { + actArguments.push('--container-architecture', 'linux/amd64'); + } + return {cwd, actArguments, proxy}; } From 336db4e6dd2a06a000366e3056a442a2073b4dd5 Mon Sep 17 00:00:00 2001 From: rory Date: Mon, 10 Jun 2024 16:51:26 -0700 Subject: [PATCH 4/4] Use docker/login-action for better security --- .github/workflows/testGithubActionsWorkflows.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testGithubActionsWorkflows.yml b/.github/workflows/testGithubActionsWorkflows.yml index 51672a07432e..f65319f14be4 100644 --- a/.github/workflows/testGithubActionsWorkflows.yml +++ b/.github/workflows/testGithubActionsWorkflows.yml @@ -25,12 +25,16 @@ jobs: - name: Setup Homebrew uses: Homebrew/actions/setup-homebrew@master + - name: Login to GitHub Container Regstry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: OSBotify + password: ${{ secrets.GITHUB_TOKEN }} + - name: Install Act run: brew install act - - name: Log into GitHub Container Registry - run: docker login ghcr.io -u OSBotify -p ${{ secrets.OS_BOTIFY_TOKEN }} - - name: Set ACT_BINARY run: echo "ACT_BINARY=$(which act)" >> "$GITHUB_ENV"