diff --git a/.github/actions/download-artifacts-from-workflow/action.yml b/.github/actions/download-artifacts-from-workflow/action.yml deleted file mode 100644 index b32971c691..0000000000 --- a/.github/actions/download-artifacts-from-workflow/action.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: 'Download artifacts from another workflow' -description: 'Download artifacts from another workflow' - -inputs: - artifacts: # id of input - description: 'Comma-separated list of downloadable artifacts' - required: true - -runs: - using: 'composite' - steps: - - name: 'Download artifacts' - uses: actions/github-script@v6 - with: - script: | - const fs = require('fs'); - const artifacts = '${{ inputs.artifacts }}'.trim().split(/[, ]+/); - console.log(`Attempting to download artifacts ${artifacts.join(', ')}`); - const workflowArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - for (const artifact of artifacts) { - const matchArtifact = workflowArtifacts.data.artifacts - .find((a) => a.name == artifact); - if (matchArtifact) { - console.log(`Found artifact ${artifact}`); - const download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - const artifactPath = `${process.env.GITHUB_WORKSPACE}/${artifact}.zip`; - fs.writeFileSync(artifactPath, Buffer.from(download.data)); - console.log(`Downloaded artifact to ${artifactPath}`); - } else { - const availableArtifacts = workflowArtifacts.data.artifacts.map((a) => a.name); - console.log(`Unable to find artifact ${artifact} (Available: ${availableArtifacts.join(', ')})`); - } - } diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7a2eb9e9ac..1e3d5bd69a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/continuous-integration-secure.yml b/.github/workflows/continuous-integration-secure.yml index 243f5ca808..59f75244fe 100644 --- a/.github/workflows/continuous-integration-secure.yml +++ b/.github/workflows/continuous-integration-secure.yml @@ -27,19 +27,19 @@ jobs: PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0] != null && github.event.workflow_run.pull_requests[0].number || '' }} IMAGE_REPO: ghcr.io/${{ github.repository }}/storybook-preview steps: - - uses: actions/checkout@v3 - - name: Download artifacts - uses: ./.github/actions/download-artifacts-from-workflow + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: - artifacts: 'storybook' - - run: mkdir -p dist/storybook - - run: unzip storybook.zip -d dist/storybook + name: storybook + path: dist/storybook/ + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GH_ACTIONS_ARTIFACT_DOWNLOAD }} - name: Remove files with forbidden extensions run: node ./scripts/clean-storybook-files.cjs - name: Create GitHub Deployment id: tag-name - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const environment = process.env.PR_NUMBER ? `preview-pr${process.env.PR_NUMBER}` : 'preview-main'; @@ -81,25 +81,22 @@ jobs: if: > github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' + env: + PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0] != null && github.event.workflow_run.pull_requests[0].number || '' }} steps: - - uses: actions/checkout@v3 - - name: Download artifacts - uses: ./.github/actions/download-artifacts-from-workflow + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: - artifacts: 'pr, coverage' - - run: unzip pr.zip - - run: mkdir coverage - - run: unzip coverage.zip -d coverage - - name: Read PR number - id: pr-number - run: echo "pr=$(> $GITHUB_OUTPUT - shell: bash + name: coverage + path: coverage/ + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GH_ACTIONS_ARTIFACT_DOWNLOAD }} - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} directory: coverage override_branch: ${{ github.event.workflow_run.head_branch }} override_commit: ${{ github.event.workflow_run.head_commit.id }} - override_pr: ${{ steps.pr-number.outputs.pr }} + override_pr: ${{ env.PR_NUMBER }} fail_ci_if_error: true verbose: true diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 221513b6e7..91dde0f632 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -11,8 +11,8 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' @@ -24,8 +24,8 @@ jobs: integrity: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' @@ -39,8 +39,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' @@ -54,27 +54,16 @@ jobs: NODE_ENV: production - name: Store coverage if: github.event_name == 'pull_request' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: coverage path: coverage/ - - name: Save PR number - if: github.event_name == 'pull_request' - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > ./pr/NR - - name: Store PR number - if: github.event_name == 'pull_request' - uses: actions/upload-artifact@v3 - with: - name: pr - path: pr/ build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' @@ -85,7 +74,7 @@ jobs: env: STORYBOOK_COMPONENTS_VERSION: ${{ github.event.pull_request.head.sha || github.sha }} - name: Store storybook artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: storybook path: dist/storybook/ @@ -95,17 +84,17 @@ jobs: if: github.event_name == 'pull_request' && github.event.pull_request.draft == false needs: [build, lint, test] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' - run: yarn install --frozen-lockfile --non-interactive - name: Generate chromatic stories run: yarn generate:chromatic-stories - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 id: version with: script: | diff --git a/.github/workflows/pr-title-lint.yml b/.github/workflows/pr-title-lint.yml index ef167d81e6..899464c057 100644 --- a/.github/workflows/pr-title-lint.yml +++ b/.github/workflows/pr-title-lint.yml @@ -9,8 +9,8 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' diff --git a/.github/workflows/preview-image-cleanup.yml b/.github/workflows/preview-image-cleanup.yml index d9c3327cb8..2fc3e88cf7 100644 --- a/.github/workflows/preview-image-cleanup.yml +++ b/.github/workflows/preview-image-cleanup.yml @@ -16,7 +16,7 @@ jobs: PACKAGE_NAME: storybook-preview PR_TAG_PREFIX: preview-pr steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: script: | const { owner, repo } = context.repo; diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 65424a349a..edc545ff6b 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -38,10 +38,10 @@ jobs: IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/lyne-components/storybook VERSION: ${{ needs.release-please.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' @@ -101,10 +101,10 @@ jobs: IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/lyne-components/storybook VERSION: ${{ needs.release-please.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn'