Skip to content

Commit 38dc43d

Browse files
authored
chore: harden GitHub Actions workflows (#3287)
1 parent 5b4c195 commit 38dc43d

11 files changed

Lines changed: 32 additions & 19 deletions

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7+
cooldown:
8+
default-days: 7

.github/workflows/closed-issue-message.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: aws-actions/closed-issue-message@v2
14+
- uses: aws-actions/closed-issue-message@10aaf6366131b673a7c8b7742f8b3849f1d44f18 # v2
1515
with:
1616
# These inputs are both required
1717
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/coverage.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ jobs:
2121
AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true
2222
steps:
2323
- name: Setup PHP with Xdebug
24-
uses: shivammathur/setup-php@v2
24+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
2525
with:
2626
coverage: xdebug
2727
php-version: '8.3'
2828
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
2929

3030
- name: Checkout codebase
31-
uses: actions/checkout@v6
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3232
with:
3333
fetch-depth: 0
34+
persist-credentials: false
3435

3536
- name: Validate composer.json and composer.lock
3637
run: composer validate
@@ -42,7 +43,7 @@ jobs:
4243
run: vendor/bin/phpunit --testsuite=unit --coverage-clover=clover.xml
4344

4445
- name: Upload coverage to Codecov
45-
uses: codecov/codecov-action@v6
46+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
4647
with:
4748
file: ./clover.xml
4849
fail_ci_if_error: false

.github/workflows/docs-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ jobs:
1515
name: Build API documentation for PHP ${{ matrix.php-versions }}
1616
steps:
1717
- name: Setup PHP with JIT
18-
uses: shivammathur/setup-php@v2
18+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
1919
with:
2020
coverage: none
2121
php-version: ${{ matrix.php-versions }}
2222
ini-values: memory_limit=4G, phar.readonly=false, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
2323

2424
- name: Checkout CodeBase
25-
uses: actions/checkout@v6
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
2628

2729
- name: Validate composer.json and composer.lock
2830
run: composer validate

.github/workflows/git-secrets-scan.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ jobs:
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v6
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
with:
18+
persist-credentials: false
1719

1820
- name: Set up Git Secrets
1921
run: |
@@ -28,8 +30,8 @@ jobs:
2830
2931
- name: Fetch previous commit
3032
run: |
31-
git fetch origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
32-
export DIFF=$(git diff origin/${{ github.base_ref }} HEAD)
33+
git fetch origin +refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}
34+
export DIFF=$(git diff origin/${GITHUB_BASE_REF} HEAD)
3335
echo "${DIFF}" > diff.txt
3436
3537
- name: Filter out skipped patterns

.github/workflows/handle-stale-discussions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
discussions: write
1515
steps:
1616
- name: Stale discussions action
17-
uses: aws-github-ops/handle-stale-discussions@v1
17+
uses: aws-github-ops/handle-stale-discussions@c0beee451a5d33d9c8f048a6d4e7c856b5422544 # v1.6.0
1818
env:
1919
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/issue-regression-labeler.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- name: Fetch template body
1414
id: check_regression
15-
uses: actions/github-script@v9
15+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
1616
env:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
TEMPLATE_BODY: ${{ github.event.issue.body }}
@@ -25,8 +25,9 @@ jobs:
2525
- name: Manage regression label
2626
env:
2727
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
STEPS_CHECK_REGRESSION_OUTPUTS_IS_REGRESSION: ${{ steps.check_regression.outputs.is_regression }}
2829
run: |
29-
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
30+
if [ "${STEPS_CHECK_REGRESSION_OUTPUTS_IS_REGRESSION}" == "true" ]; then
3031
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
3132
else
3233
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}

.github/workflows/model-changes.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ jobs:
1313
name: Check for model changes
1414
steps:
1515
- name: Checkout codebase
16-
uses: actions/checkout@v6
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1717
with:
1818
fetch-depth: 0
19+
persist-credentials: false
1920
- run: |
20-
BASE_REPO="${{ github.event.pull_request.base.repo.clone_url }}"
21+
BASE_REPO="${GITHUB_EVENT_PULL_REQUEST_BASE_REPO_CLONE_URL}"
2122
git fetch $BASE_REPO master:master -q
2223
CHANGED_FILES=$(git diff --name-only FETCH_HEAD...HEAD -- src/data/)
2324
if [ ! -z "$CHANGED_FILES" ]; then
2425
echo "Changes detected in the following models:"
2526
echo "$CHANGED_FILES"
2627
exit 1
2728
fi
29+
env:
30+
GITHUB_EVENT_PULL_REQUEST_BASE_REPO_CLONE_URL: ${{ github.event.pull_request.base.repo.clone_url }}

.github/workflows/stale_issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
name: Stale issue job
1818
steps:
19-
- uses: aws-actions/stale-issue-cleanup@v6
19+
- uses: aws-actions/stale-issue-cleanup@7de35968489e4142233d2a6812519a82e68b5c38 # v6
2020
with:
2121
# Setting messages to an empty string will cause the automation to skip
2222
# that category

.github/workflows/tests-windows.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ jobs:
3333
AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true
3434
steps:
3535
- name: Setup PHP with JIT
36-
uses: shivammathur/setup-php@v2
36+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
3737
with:
3838
coverage: none
3939
php-version: ${{ matrix.php-versions }}
4040
ini-values: memory_limit=4G, phar.readonly=false, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
4141
extensions: sockets
4242

4343
- name: Checkout codebase
44-
uses: actions/checkout@v6
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4545
with:
4646
fetch-depth: 0
47+
persist-credentials: false
4748

4849
- name: Validate composer.json and composer.lock
4950
run: composer validate

0 commit comments

Comments
 (0)