diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..99e255a --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,38 @@ +name: Test pr +on: + pull_request: + types: + - opened + - synchronize + - reopened +jobs: + hehe: + runs-on: ubuntu-latest + strategy: + matrix: + bull: [1, 2, 3, 4, 5] + outputs: + hehe: ${{ steps.hehe.outputs.hehe }} + steps: + - run: echo "hehe=${{ matrix.bull }}" >> $GITHUB_OUTPUT + id: hehe + - uses: cloudposse/github-action-matrix-outputs-write@v1 + id: out + with: + matrix-step-name: ${{ github.job }} + matrix-key: ${{ matrix.bull }} + outputs: |- + hehe: ${{ matrix.bull }} + ble: "bara prufa" + bull: + runs-on: ubuntu-latest + needs: + - hehe + steps: + - uses: cloudposse/github-action-matrix-outputs-read@v1 + id: read + with: + matrix-step-name: hehe + - run: echo "${{ steps.read.outputs.result }}" + + diff --git a/ci/test.mjs b/ci/test.mjs index 0744fae..935e7d0 100644 --- a/ci/test.mjs +++ b/ci/test.mjs @@ -1,3 +1,4 @@ +// @ts-check import github from "@actions/github"; import core from "@actions/core"; @@ -14,7 +15,7 @@ core.setOutput("ARTIFACT_NAME", artifactName); core.setOutput("TAG_NAME", tagName); function getTagname() { - if (eventName === "pull_request") { + if (eventName === "pull_request" && context.payload.pull_request?.number) { return `pr-${context.payload.pull_request.number}-${randomTag}`; } if (eventName === "merge_group") { @@ -29,9 +30,8 @@ function getTagname() { } - function getArtifactname() { - if (eventName === "pull_request") { + if (eventName === "pull_request" && context.payload.pull_request?.number) { return `pr-${context.payload.pull_request.number}`; } if (eventName === "merge_group") { @@ -71,7 +71,7 @@ function getTypeOfDeployment() { function getTargetBranch() { - if (eventName === "pull_request") { + if (eventName === "pull_request" && context.payload?.pull_request?.base.ref) { return context.payload.pull_request.base.ref; } if (eventName === "merge_group") { diff --git a/ci/upload_artifacts.mjs b/ci/upload_artifacts.mjs new file mode 100644 index 0000000..c962b90 --- /dev/null +++ b/ci/upload_artifacts.mjs @@ -0,0 +1,12 @@ +// @ts-check + +import artifact from "@actions/artifact"; + +const artifactName = process.env.ARTIFACT_NAME; +const tagName = process.env.TAG_NAME; +const artifact = generateArtifact(); + + +function generateArtifact() { + return {}; +} \ No newline at end of file diff --git a/package.json b/package.json index da728b6..a0751d2 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "packageManager": "yarn@4.2.2", "devDependencies": { "@actions/core": "^1.11.1", - "@actions/github": "^6.0.0" + "@actions/github": "^6.0.0", + "@types/node": "^22.13.4" } } diff --git a/yarn.lock b/yarn.lock index 8b25ea3..ea50b3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -180,6 +180,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^22.13.4": + version: 22.13.4 + resolution: "@types/node@npm:22.13.4" + dependencies: + undici-types: "npm:~6.20.0" + checksum: 10c0/3a234fa7766a3efc382cf81f66f474c26cdab2f54f43f757634c81c0444eb2160c2dabbde9741e4983078a318a88515b65416b5f1ab5478548579d7b3ead1d95 + languageName: node + linkType: hard + "before-after-hook@npm:^2.2.0": version: 2.2.3 resolution: "before-after-hook@npm:2.2.3" @@ -193,6 +202,7 @@ __metadata: dependencies: "@actions/core": "npm:^1.11.1" "@actions/github": "npm:^6.0.0" + "@types/node": "npm:^22.13.4" languageName: unknown linkType: soft @@ -219,6 +229,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~6.20.0": + version: 6.20.0 + resolution: "undici-types@npm:6.20.0" + checksum: 10c0/68e659a98898d6a836a9a59e6adf14a5d799707f5ea629433e025ac90d239f75e408e2e5ff086afc3cace26f8b26ee52155293564593fbb4a2f666af57fc59bf + languageName: node + linkType: hard + "undici@npm:^5.25.4": version: 5.28.5 resolution: "undici@npm:5.28.5"