-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable auto-publish and update dependencies (#248)
Review with whitespace diffing off for an easier time. https://github.com/google-github-actions/setup-cloud-sdk/pull/248/files?w=1
- Loading branch information
Showing
7 changed files
with
219 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,80 +17,80 @@ jobs: | |
runs-on: 'ubuntu-latest' | ||
|
||
steps: | ||
- uses: 'actions/checkout@v4' | ||
|
||
- uses: 'actions/setup-go@v4' | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: 'Get versions list' | ||
run: |- | ||
mkdir -p ./data | ||
go run ./cmd/compile-versions/main.go > ./data/versions.json | ||
echo "Computed versions:" | ||
cat ./data/versions.json | ||
- id: 'updates' | ||
name: 'Update versions list' | ||
run: |- | ||
if git diff --exit-code ./data/versions.json; then | ||
echo "No changes" | ||
exit 0 | ||
fi | ||
echo "had_changes=true" >> ${GITHUB_OUTPUT} | ||
git config user.name "google-github-actions-bot" | ||
git config user.email "[email protected]" | ||
git checkout -b "${{ env.PR_BRANCH }}" | ||
git add ./data/versions.json | ||
git commit -m "Update gcloud versions ($(date --iso-8601=h))" | ||
git push -f origin "${{ env.PR_BRANCH }}" | ||
- name: 'Create Pull Request' | ||
if: steps.updates.outputs.had_changes == 'true' | ||
uses: 'actions/github-script@v6' | ||
with: | ||
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}' | ||
script: |- | ||
const baseBranch = `${{ github.ref_name }}`; | ||
const prBranch = `${{ env.PR_BRANCH }}`; | ||
const prBody = `Update latest gcloud versions`; | ||
try { | ||
const listResponse = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: `open`, | ||
head: `${context.repo.owner}:${prBranch}`, | ||
base: baseBranch, | ||
}); | ||
core.isDebug() && console.log(listResponse); | ||
if(!listResponse.data.length) { | ||
const createResponse = await github.rest.pulls.create({ | ||
- uses: 'actions/checkout@v4' | ||
|
||
- uses: 'actions/setup-go@v5' | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: 'Get versions list' | ||
run: |- | ||
mkdir -p ./data | ||
go run ./cmd/compile-versions/main.go > ./data/versions.json | ||
echo "Computed versions:" | ||
cat ./data/versions.json | ||
- id: 'updates' | ||
name: 'Update versions list' | ||
run: |- | ||
if git diff --exit-code ./data/versions.json; then | ||
echo "No changes" | ||
exit 0 | ||
fi | ||
echo "had_changes=true" >> ${GITHUB_OUTPUT} | ||
git config user.name "google-github-actions-bot" | ||
git config user.email "[email protected]" | ||
git checkout -b "${{ env.PR_BRANCH }}" | ||
git add ./data/versions.json | ||
git commit -m "Update gcloud versions ($(date --iso-8601=h))" | ||
git push -f origin "${{ env.PR_BRANCH }}" | ||
- name: 'Create Pull Request' | ||
if: steps.updates.outputs.had_changes == 'true' | ||
uses: 'actions/github-script@v7' | ||
with: | ||
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}' | ||
script: |- | ||
const baseBranch = `${{ github.ref_name }}`; | ||
const prBranch = `${{ env.PR_BRANCH }}`; | ||
const prBody = `Update latest gcloud versions`; | ||
try { | ||
const listResponse = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: `Update gcloud versions`, | ||
body: prBody, | ||
head: prBranch, | ||
state: `open`, | ||
head: `${context.repo.owner}:${prBranch}`, | ||
base: baseBranch, | ||
}); | ||
core.info(`Created PR #${createResponse.data.number} at ${createResponse.data.html_url}`); | ||
} else { | ||
const updateResponse = await github.rest.pulls.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: listResponse.data[0].number, | ||
title: `Update gcloud versions`, | ||
body: prBody, | ||
}); | ||
core.info(`Updated PR #${updateResponse.data.number} at ${updateResponse.data.html_url}`); | ||
core.isDebug() && console.log(listResponse); | ||
if(!listResponse.data.length) { | ||
const createResponse = await github.rest.pulls.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: `Update gcloud versions`, | ||
body: prBody, | ||
head: prBranch, | ||
base: baseBranch, | ||
}); | ||
core.info(`Created PR #${createResponse.data.number} at ${createResponse.data.html_url}`); | ||
} else { | ||
const updateResponse = await github.rest.pulls.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: listResponse.data[0].number, | ||
title: `Update gcloud versions`, | ||
body: prBody, | ||
}); | ||
core.info(`Updated PR #${updateResponse.data.number} at ${updateResponse.data.html_url}`); | ||
} | ||
} catch(err) { | ||
console.error(err); | ||
core.setFailed(`Failed to create pull request: ${err}`); | ||
} | ||
} catch(err) { | ||
console.error(err); | ||
core.setFailed(`Failed to create pull request: ${err}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,44 @@ | ||
module github.com/google-github-actions/setup-cloud-sdk | ||
|
||
go 1.20 | ||
go 1.22 | ||
|
||
require ( | ||
cloud.google.com/go/storage v1.31.0 | ||
github.com/maruel/natural v1.1.0 | ||
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 | ||
google.golang.org/api v0.126.0 | ||
cloud.google.com/go/storage v1.40.0 | ||
github.com/maruel/natural v1.1.1 | ||
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 | ||
google.golang.org/api v0.172.0 | ||
) | ||
|
||
require ( | ||
cloud.google.com/go v0.110.2 // indirect | ||
cloud.google.com/go/compute v1.19.3 // indirect | ||
cloud.google.com/go v0.112.2 // indirect | ||
cloud.google.com/go/compute v1.25.1 // indirect | ||
cloud.google.com/go/compute/metadata v0.2.3 // indirect | ||
cloud.google.com/go/iam v1.1.0 // indirect | ||
cloud.google.com/go/iam v1.1.7 // indirect | ||
github.com/felixge/httpsnoop v1.0.4 // indirect | ||
github.com/go-logr/logr v1.4.1 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/go-cmp v0.5.9 // indirect | ||
github.com/google/s2a-go v0.1.4 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect | ||
github.com/googleapis/gax-go/v2 v2.11.0 // indirect | ||
github.com/golang/protobuf v1.5.4 // indirect | ||
github.com/google/s2a-go v0.1.7 // indirect | ||
github.com/google/uuid v1.6.0 // indirect | ||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect | ||
github.com/googleapis/gax-go/v2 v2.12.3 // indirect | ||
go.opencensus.io v0.24.0 // indirect | ||
golang.org/x/crypto v0.17.0 // indirect | ||
golang.org/x/net v0.17.0 // indirect | ||
golang.org/x/oauth2 v0.8.0 // indirect | ||
golang.org/x/sys v0.15.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.50.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect | ||
go.opentelemetry.io/otel v1.25.0 // indirect | ||
go.opentelemetry.io/otel/metric v1.25.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.25.0 // indirect | ||
golang.org/x/crypto v0.22.0 // indirect | ||
golang.org/x/net v0.24.0 // indirect | ||
golang.org/x/oauth2 v0.19.0 // indirect | ||
golang.org/x/sync v0.7.0 // indirect | ||
golang.org/x/sys v0.19.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect | ||
google.golang.org/grpc v1.56.3 // indirect | ||
golang.org/x/time v0.5.0 // indirect | ||
google.golang.org/genproto v0.0.0-20240412170617-26222e5d3d56 // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20240412170617-26222e5d3d56 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240412170617-26222e5d3d56 // indirect | ||
google.golang.org/grpc v1.63.2 // indirect | ||
google.golang.org/protobuf v1.33.0 // indirect | ||
) |
Oops, something went wrong.