Skip to content

Commit 8c4d81d

Browse files
authored
Move curl commands to setup scripts into a composite action (#22420)
1 parent ec6232b commit 8c4d81d

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Setup Workflow Scripts'
2+
description: 'Installs test scripts from the action context to the workspace'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Ensure target directory exists
7+
shell: bash
8+
run: mkdir -p .github/workflows/scripts
9+
10+
- name: Install scripts from Action Context
11+
shell: bash
12+
# Copies scripts from the downloaded action folder (pinned SHA) to the workspace
13+
run: |
14+
cp "${{ github.action_path }}/src/setup-test-env.sh" .github/workflows/scripts/
15+
cp "${{ github.action_path }}/src/run-unit-integration-tests.sh" .github/workflows/scripts/
16+
cp "${{ github.action_path }}/src/run-e2e-tests.sh" .github/workflows/scripts/
17+
18+
# Ensure executable permissions
19+
chmod +x .github/workflows/scripts/*.sh
File renamed without changes.

.github/workflows/scripts/run-unit-integration-tests.sh renamed to .github/actions/setup-test-target-scripts/src/run-unit-integration-tests.sh

File renamed without changes.
File renamed without changes.

.github/workflows/test-target.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,12 @@ jobs:
112112
113113
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
114114

115-
- name: Download workflow scripts
116-
if: inputs.repo != 'core'
117-
run: |
118-
mkdir -p .github/workflows/scripts
119-
curl -sL https://raw.githubusercontent.com/DataDog/integrations-core/master/.github/workflows/scripts/setup-test-env.sh -o .github/workflows/scripts/setup-test-env.sh
120-
curl -sL https://raw.githubusercontent.com/DataDog/integrations-core/master/.github/workflows/scripts/run-unit-integration-tests.sh -o .github/workflows/scripts/run-unit-integration-tests.sh
121-
curl -sL https://raw.githubusercontent.com/DataDog/integrations-core/master/.github/workflows/scripts/run-e2e-tests.sh -o .github/workflows/scripts/run-e2e-tests.sh
122-
chmod +x .github/workflows/scripts/*.sh
115+
# We run this for EVERYONE to ensure the scripts are moved
116+
# from the action folder to the expected workspace path.
117+
# It should cover all repos using this workflow and respect the context if the
118+
# workflow is being called with a pinned version.
119+
- name: Install workflow scripts
120+
uses: ./.github/actions/setup-test-target-scripts
123121

124122
- name: Set environment variables
125123
# This step sets the following environment variables for the entire workflow via setup-test-env.sh:

0 commit comments

Comments
 (0)