Skip to content

Commit 2f427f8

Browse files
authored
Merge pull request #4457 from DataDog/tonycthsu/actionlint
Scan with `actionlint`
2 parents 1e9d70f + 77d83ef commit 2f427f8

9 files changed

+67
-40
lines changed

.github/workflows/_unit_test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
LOCKFILE: lockfile-${{ inputs.alias }}-${{ github.run_id }}
4343
run: |
4444
bundle lock
45-
echo "lockfile=$LOCKFILE" >> $GITHUB_OUTPUT
45+
echo "lockfile=$LOCKFILE" >> "$GITHUB_OUTPUT"
4646
4747
- name: Upload lockfile
4848
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
@@ -73,8 +73,8 @@ jobs:
7373
batches_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["batches"].to_json')
7474
misc_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["misc"].to_json')
7575
76-
echo "batches=$batches_data" >> $GITHUB_OUTPUT
77-
echo "misc=$misc_data" >> $GITHUB_OUTPUT
76+
echo "batches=$batches_data" >> "$GITHUB_OUTPUT"
77+
echo "misc=$misc_data" >> "$GITHUB_OUTPUT"
7878
- name: Generate batch summary
7979
run: bundle exec rake github:generate_batch_summary
8080
env:

.github/workflows/add-milestone-to-pull-requests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
# Parse the gemspec and return the major version
2424
id: version
2525
run: |
26-
echo "::set-output name=version::$(find . -name *.gemspec | ruby -ne 'puts Gem::Specification.load($_.chomp).version.to_s.split(".").first')"
26+
echo "name=version::$(find . -name "*.gemspec" | ruby -ne "puts Gem::Specification.load($_.chomp).version.to_s.split(\".\").first")" >> "$GITHUB_OUTPUT"
2727
2828
- name: Get project milestones
2929
id: milestones

.github/workflows/build-gem.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
GIT_REF: ${{ github.ref }}
4848
GIT_SHA: ${{ github.sha }}
4949
run: |
50-
.gitlab/patch_gem_version.sh gha $GHA_RUN_ID $GIT_REF $GIT_SHA;
50+
.gitlab/patch_gem_version.sh gha "$GHA_RUN_ID" "$GIT_REF" "$GIT_SHA";
5151
5252
- name: Patch gem host
5353
if: ${{ matrix.type != 'final' }}
@@ -56,7 +56,7 @@ jobs:
5656
sed datadog.gemspec -i -e "s,^\([\t ]*spec\.metadata\['allowed_push_host'\]\) *= *,\1 = \'${GEM_HOST}\' # ,"
5757
5858
# Test result
59-
cat datadog.gemspec | grep -e allowed_push_host
59+
grep -e allowed_push_host datadog.gemspec
6060
- name: Build gem
6161
run: bundle exec rake build
6262
- name: List gem

.github/workflows/cache-cleanup.yml

+22-18
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,50 @@ jobs:
1616
steps:
1717
- name: Cleanup
1818
run: |
19-
echo "# Cache Cleanup Summary" >> $GITHUB_STEP_SUMMARY
20-
echo "" >> $GITHUB_STEP_SUMMARY
21-
echo "**PR Number:** #${{ github.event.pull_request.number }}" >> $GITHUB_STEP_SUMMARY
22-
echo "**Branch:** \`$BRANCH\`" >> $GITHUB_STEP_SUMMARY
23-
echo "" >> $GITHUB_STEP_SUMMARY
19+
{
20+
echo "# Cache Cleanup Summary"
21+
echo ""
22+
echo "**PR Number:** #${{ github.event.pull_request.number }}"
23+
echo "**Branch:** \`$BRANCH\`"
24+
echo ""
25+
} >> "$GITHUB_STEP_SUMMARY"
2426
2527
echo "[DEBUG] Fetching cache list..."
2628
# Get full cache details
27-
CACHE_LIST=$(gh cache list --ref $BRANCH --limit 100 --json key,sizeInBytes,id)
29+
CACHE_LIST=$(gh cache list --ref "$BRANCH" --limit 100 --json key,sizeInBytes,id)
2830
2931
if [ -z "$CACHE_LIST" ] || [ "$CACHE_LIST" = "[]" ]; then
3032
echo "[DEBUG] No caches found"
31-
echo "No caches found for this PR" >> $GITHUB_STEP_SUMMARY
33+
echo "No caches found for this PR" >> "$GITHUB_STEP_SUMMARY"
3234
exit 0
3335
fi
3436
35-
# Create table header
36-
echo "| Cache ID | Cache Key | Size |" >> $GITHUB_STEP_SUMMARY
37-
echo "|----------|-----------|------|" >> $GITHUB_STEP_SUMMARY
37+
{
38+
echo "| Cache ID | Cache Key | Size |"
39+
echo "|----------|-----------|------|"
40+
} >> "$GITHUB_STEP_SUMMARY"
3841
3942
# Extract IDs and process deletions
4043
echo "$CACHE_LIST" | jq -r '.[] | [.id, .key, .sizeInBytes] | @tsv' | while IFS=$'\t' read -r id key size; do
4144
# Convert size to human readable format
42-
if [ $size -ge 1048576 ]; then
43-
readable_size=$(echo "scale=2; $size/1048576" | bc)"MB"
45+
if [ "$size" -ge 1048576 ]; then
46+
readable_size=$(echo "scale=2; $size/1048576" | bc 2>/dev/null || echo "$size")"MB"
4447
else
45-
readable_size=$(echo "scale=2; $size/1024" | bc)"KB"
48+
readable_size=$(echo "scale=2; $size/1024" | bc 2>/dev/null || echo "$size")"KB"
4649
fi
4750
4851
echo "[DELETE] Processing cache ID: $id"
49-
gh cache delete $id
52+
gh cache delete "$id"
5053
echo "[INFO] Processed cache $id"
5154
5255
# Add row to summary table
53-
echo "| \`$id\` | \`$key\` | $readable_size |" >> $GITHUB_STEP_SUMMARY
56+
echo "| \`$id\` | \`$key\` | $readable_size |" >> "$GITHUB_STEP_SUMMARY"
5457
done
5558
56-
# Add completion timestamp
57-
echo "" >> $GITHUB_STEP_SUMMARY
58-
echo "Cleanup completed at: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
59+
{
60+
echo ""
61+
echo "Cleanup completed at: $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
62+
} >> "$GITHUB_STEP_SUMMARY"
5963
env:
6064
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6165
GH_REPO: ${{ github.repository }}

.github/workflows/check.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- name: Check types
7878
run: bundle exec rake steep:check
7979
- name: Record stats
80-
run: bundle exec rake steep:stats[md] >> $GITHUB_STEP_SUMMARY
80+
run: bundle exec rake steep:stats[md] >> "$GITHUB_STEP_SUMMARY"
8181

8282
# Dogfooding Datadog SBOM Analysis
8383
dd-software-composition-analysis:
@@ -147,6 +147,17 @@ jobs:
147147
env:
148148
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149149

150+
actionlint:
151+
name: actionlint
152+
runs-on: ubuntu-24.04
153+
steps:
154+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
155+
with:
156+
persist-credentials: false
157+
- uses: docker://rhysd/actionlint:1.7.7
158+
with:
159+
args: -color
160+
150161
complete:
151162
name: Static Analysis (complete)
152163
needs:
@@ -157,6 +168,7 @@ jobs:
157168
- 'dd-software-composition-analysis'
158169
- 'dd-static-analysis'
159170
- 'zizmor'
171+
- 'actionlint'
160172
runs-on: ubuntu-24.04
161173
steps:
162174
- run: echo "Done"

.github/workflows/publish.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
ruby-version: '3.3.7'
2626

2727
- id: version
28-
run: echo "version=$(ruby -e 'puts Gem::Specification::load(Dir.glob("*.gemspec").first).version')" >> $GITHUB_OUTPUT
28+
run: echo "version=$(ruby -e 'puts Gem::Specification::load(Dir.glob("*.gemspec").first).version')" >> "$GITHUB_OUTPUT"
2929

3030
# Check if the gem version is already published
3131
- name: Verify gem version
@@ -138,10 +138,10 @@ jobs:
138138
steps:
139139
- name: Download from RubyGems
140140
run: |
141-
gem fetch datadog --version ${GEM_VERSION} --verbose
141+
gem fetch datadog --version "${GEM_VERSION}" --verbose
142142
- name: Attach to existing release draft
143143
run: |
144-
gh release upload "v${GEM_VERSION}" *.gem --clobber
144+
gh release upload "v${GEM_VERSION}" -- *.gem --clobber
145145
gh release edit "v${GEM_VERSION}" --draft=false
146146
147147
update-gem-version:
@@ -167,7 +167,7 @@ jobs:
167167
- run: bundle install
168168
- id: next_version
169169
run: |
170-
echo "next_version=$(bundle exec rake version:next)" >> $GITHUB_OUTPUT
170+
echo "next_version=$(bundle exec rake version:next)" >> "$GITHUB_OUTPUT"
171171
172172
# https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28
173173
milestone:

.github/workflows/system-tests.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,11 @@ jobs:
172172
- name: Read forced-tests-list.json file
173173
id: read_forced_tests_list
174174
run: |
175-
echo "FORCED_TESTS_LIST<<EOF" >> $GITHUB_OUTPUT
176-
echo "$(cat binaries/dd-trace-rb/.github/forced-tests-list.json)" >> $GITHUB_OUTPUT
177-
echo "EOF" >> $GITHUB_OUTPUT
175+
{
176+
printf "FORCED_TESTS_LIST<<EOF\n"
177+
cat binaries/dd-trace-rb/.github/forced-tests-list.json
178+
printf "\nEOF\n"
179+
} >> "$GITHUB_OUTPUT"
178180
- name: Login to Docker Hub
179181
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
180182
with:
@@ -201,12 +203,17 @@ jobs:
201203
for tag in latest; do
202204
cache_from+=(--cache-from "${{ env.REPO }}/system-tests/${{ matrix.library.name }}/${{ matrix.image }}-${{ matrix.app }}:${tag}")
203205
done
206+
204207
parents="$(cd 'binaries/${{ matrix.library.path }}' && git rev-list --parents -n 1 ${{ github.sha }})"
205-
for sha in $parents; do
206-
cache_from+=(--cache-from ${{ env.REPO }}/system-tests/${{ matrix.library.name }}/${{ matrix.image }}-${{ matrix.app }}:g${sha})
208+
209+
# Use read to properly split the string into an array
210+
read -ra parent_shas <<< "$parents"
211+
for sha in "${parent_shas[@]}"; do
212+
cache_from+=(--cache-from "${{ env.REPO }}/system-tests/${{ matrix.library.name }}/${{ matrix.image }}-${{ matrix.app }}:g${sha}")
207213
done
214+
208215
echo "cache args: ${cache_from[*]}"
209-
./build.sh --library ${{ matrix.library.name }} --weblog-variant ${{ matrix.app }} --images ${{ matrix.image }} --extra-docker-args "${cache_from[*]}"
216+
./build.sh --library "${{ matrix.library.name }}" --weblog-variant "${{ matrix.app }}" --images "${{ matrix.image }}" --extra-docker-args "${cache_from[*]}"
210217
- name: Tag image for CI run
211218
run: docker tag system_tests/${{ matrix.image }}:latest ${{ env.REPO }}/system-tests/${{ matrix.library.name }}/${{ matrix.image }}-${{ matrix.app }}:gha${{ github.run_id }}-g${{ github.sha }}
212219
- name: Push image for CI run
@@ -444,7 +451,7 @@ jobs:
444451
- name: Print fancy log report
445452
run: |
446453
find logs*
447-
python utils/scripts/markdown_logs.py >> $GITHUB_STEP_SUMMARY
454+
python utils/scripts/markdown_logs.py >> "$GITHUB_STEP_SUMMARY"
448455
449456
cleanup:
450457
strategy:

.github/workflows/test-memory-leaks.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ jobs:
3838
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
3939
bundler: latest
4040
cache-version: v2 # bump this to invalidate cache
41-
- run: env RUBY_FREE_AT_EXIT=1 LSAN_OPTIONS=verbosity=0:log_threads=1:suppressions=`pwd`/suppressions/lsan.supp ASAN_OPTIONS=detect_leaks=1 bundle exec rake spec:profiling:main
41+
- run: bundle exec rake spec:profiling:main
42+
env:
43+
RUBY_FREE_AT_EXIT: 1
44+
LSAN_OPTIONS: verbosity=0:log_threads=1:suppressions=${{ github.workspace }}/suppressions/lsan.supp
45+
ASAN_OPTIONS: detect_leaks=1
4246

4347
complete:
4448
name: Test for memory leaks (complete)

.github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ jobs:
152152
- if: github.event_name == 'pull_request'
153153
env:
154154
DD_GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
155-
run: echo "DD_GIT_COMMIT_SHA=$DD_GIT_COMMIT_SHA" >> $GITHUB_ENV
155+
run: echo "DD_GIT_COMMIT_SHA=$DD_GIT_COMMIT_SHA" >> "$GITHUB_ENV"
156156
- if: github.event_name != 'pull_request'
157157
env:
158158
DD_GIT_COMMIT_SHA: ${{ github.sha }}
159-
run: echo "DD_GIT_COMMIT_SHA=$DD_GIT_COMMIT_SHA" >> $GITHUB_ENV
160-
- run: echo $DD_GIT_COMMIT_SHA
159+
run: echo "DD_GIT_COMMIT_SHA=$DD_GIT_COMMIT_SHA" >> "$GITHUB_ENV"
160+
- run: echo "$DD_GIT_COMMIT_SHA"
161161
- name: Upload junit reports
162162
run: datadog-ci junit upload --verbose tmp/rspec/
163163

0 commit comments

Comments
 (0)