Skip to content

Commit

Permalink
ci: use commit hashes for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-FFFFFF committed Jan 20, 2025
1 parent 7653ea5 commit 38d3955
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -49,4 +49,4 @@ jobs:


- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
12 changes: 9 additions & 3 deletions .github/workflows/docs-fmt-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: latest
terraform_wrapper: false

- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: '1.23.x'
go-version-file: tests/go.mod
cache-dependency-path: tests/go.sum

- name: Install tools
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go-test-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ jobs:
run: env | sort

- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.terraform_version }}
terraform_wrapper: false

- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: '1.20.x'
go-version-file: tests/go.mod
cache-dependency-path: tests/go.sum

- name: Azure login
uses: azure/login@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:

# This only works on Linux based runners
- name: Azure logout
uses: azure/CLI@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
if: always()
with:
inlineScript: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/go-test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ jobs:
terraform_version: ['latest', '1.8.0']
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.terraform_version }}
terraform_wrapper: false

- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: tests/go.mod
cache-dependency-path: tests/go.sum
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/housekeep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Azure login
uses: azure/login@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
allow-no-subscriptions: true

- name: Azure cancel subscriptions
uses: azure/CLI@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
continue-on-error: true
with:
inlineScript: |
Expand All @@ -31,7 +31,7 @@ jobs:
az account subscription list | jq -r '.[] | select(.state == "Enabled") | select(.displayName | test("^testdeploy.*")) | .subscriptionId' | xargs -n1 -I% az account subscription cancel --yes --id %
echo "==> Done cancelling subscriptions"
- name: Azure logout
uses: azure/CLI@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
if: always()
with:
inlineScript: |
Expand All @@ -44,14 +44,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Azure login
uses: azure/login@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
allow-no-subscriptions: true

- name: Azure delete subscription aliases
uses: azure/CLI@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
continue-on-error: true
with:
inlineScript: |
Expand All @@ -61,7 +61,7 @@ jobs:
az rest --method GET --uri '/providers/Microsoft.Subscription/aliases/?api-version=2021-10-01' | jq -r '.value[] | select(.name | test("^testdeploy")) | .name' | xargs -n1 -I% az rest --method DELETE --uri '/providers/Microsoft.Subscription/aliases/%?api-version=2021-10-01'
echo "==> Done deleting subscription aliases"
- name: Azure logout
uses: azure/CLI@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
if: always()
with:
inlineScript: |
Expand All @@ -74,7 +74,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Azure login
uses: azure/login@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -89,14 +89,14 @@ jobs:
echo "==> removing locks"
az lock list | jq '.[].id' | xargs az lock delete --ids
fi
echo "==> Deleting the following resource groups:"
az group list | jq -r '.[] | select(.name | test("^testdeploy-")) | .name'
az group list | jq -r '.[] | select(.name | test("^testdeploy-")) | .name' | xargs -I% -P5 az group delete --yes --name %
echo "==> Done deleting resource groups"
- name: Azure logout
uses: azure/CLI@v2
uses: azure/CLI@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2.1.0
if: always()
with:
inlineScript: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/module-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
MODULE_JSON_QUERY: .locals.module_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- run: |
VER=$(curl --silent -L -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .name | sed s/^v//)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
steps:
- uses: amannn/[email protected]
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ jobs:
name: super linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: latest
terraform_wrapper: false

- name: Run github/super-linter/slim
uses: github/super-linter/slim@v5
uses: github/super-linter/slim@b807e99ddd37e444d189cfd2c2ca1274d8ae8ef1 # v7
env:
# Lint all code
VALIDATE_ALL_CODEBASE: true
Expand Down Expand Up @@ -51,14 +53,16 @@ jobs:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup go
uses: actions/setup-go@v5
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: tests/go.mod
cache-dependency-path: tests/go.sum

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
with:
version: v1.55.2
working-directory: ${{ github.workspace }}/tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wiki-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Repo
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ env.wiki_source_repo }}
path: ${{ env.wiki_source_repo }}

- name: Checkout Wiki Repo
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ env.wiki_target_repo }}
path: ${{ env.wiki_target_repo }}
Expand Down

0 comments on commit 38d3955

Please sign in to comment.