Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test - Go mod dependabot #4021

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/dependabotpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Go Mod on Dependabot PRs

on: [push]

jobs:
tidy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
if: github.actor == 'dependabot[bot]' || github.actor == 'Realmonia'
steps:
- name: Check secret availability
run: |
if [ -z "${{ secrets.NEW_TEST_SECRET }}" ]; then
echo "Secret is empty or not set."
else
echo "Secret is set."
fi
- uses: actions/checkout@v3
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
ref: ${{ github.head_ref }}
token: ${{ secrets.NEW_TEST_SECRET }}
- name: get GO_VERSION
id: get-go-version
run: |
cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent
set -eou pipefail
go_version=$(cat -e GO_VERSION)
go_version=${go_version%?}
go_version_length=${#go_version}
go_version_re="^([0-9]+\.){1,2}([0-9]+)$"
if ! [[ $go_version_length -le 10 && $go_version =~ $go_version_re ]] ; then
echo "invalid GO version"
exit 1
fi
echo "GO_VERSION=$go_version" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION }}
- name: Run go mod tidy and go mod vendor in all modules
run: |
cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent/ecs-agent/daemonimages/csidriver && go mod tidy && go mod vendor
cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent/ecs-agent && go mod tidy && go mod vendor
cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent/agent && go mod tidy && go mod vendor
- name: Commit and push if changes are detected
run: |
cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent/
git config user.name 'Realmonia'
git config user.email 'han.heming@icloud.com'
git add -A
git commit -m "Run go mod tidy" -a || echo "No changes to commit"
git push
with:
token: ${{ secrets.NEW_TEST_SECRET }}
1 change: 1 addition & 0 deletions .github/workflows/gitsecrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
- uses: actions/checkout@v3
with:
path: src/github.com/aws/amazon-ecs-agent
ref: ${{ github.head_ref }}
- name: Git Secrets Scan Script
run: |
set -ex
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gomod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
ref: ${{ github.head_ref }}
- name: get GO_VERSION
id: get-go-version
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Linux

on: [pull_request]
on: [push, pull_request]

permissions: read-all
jobs:
Expand All @@ -12,6 +12,7 @@ jobs:
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
ref: ${{ github.head_ref }}
- name: get GO_VERSION
id: get-go-version
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
- uses: actions/checkout@v3
with:
path: src/github.com/aws/amazon-ecs-agent
ref: ${{ github.head_ref }}
- name: get GO_VERSION
id: get-go-version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Windows

on: [pull_request]
on: [push, pull_request]

permissions: read-all
jobs:
Expand Down
Loading