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

fix: update references from master -> main #544

Merged
merged 1 commit into from
Apr 5, 2022
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 'release'
on:
push:
branches:
- 'master'
- 'main'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
commit-message: 'Build dist'
title: 'chore: build dist'
body: 'Build compiled Typescript'
base: 'master'
base: 'main'
branch: 'actions/build'
push-to-fork: 'google-github-actions-bot/setup-gcloud'
delete-branch: true
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/setup-gcloud-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: setup-gcloud Integration
on:
push:
branches:
- "master"
- 'main'
pull_request:
branches:
- "master"
- 'main'
workflow_dispatch:

concurrency:
group: "${{github.workflow}}-${{ github.head_ref || github.ref }}"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/setup-gcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: setup-gcloud Unit
on:
push:
branches:
- 'master'
- 'main'
pull_request:
branches:
- 'master'
- 'main'
workflow_dispatch:


concurrency:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
#
#
# https://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing permissions and limitations under the
Expand Down Expand Up @@ -65,7 +65,7 @@ Thumbs.db
node_modules/
runner/

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Rest of the file pulled from https://github.com/github/gitignore/blob/main/Node.gitignore
# Logs
logs
*.log
Expand Down
29 changes: 0 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,6 @@ Or integrate natively with other Google Cloud GitHub Actions:
* [Upload to Cloud Storage](https://github.com/google-github-actions/upload-cloud-storage)
* [Configure GKE credentials](https://github.com/google-github-actions/get-gke-credentials)

## 📢 NOTICES

- **Do not pin this action to `@master`, use `@v0` instead. We are going to
rename the branch to `main` in 2022 and this _will break_ existing
workflows. See [Versioning](#versioning) for more information.**

- **Previously this repository contained the code for ALL of the GCP GitHub
Actions. Now each action has it's own repo and this repo is only for
`setup-gcloud`.**

For `setup-gcloud`:

```diff
steps:
- id: gcloud
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
+ uses: google-github-actions/setup-gcloud@v0
```

For other actions (example uses `deploy-cloudrun`):

```diff
steps:
- id: deploy
- uses: GoogleCloudPlatform/github-actions/deploy-cloudrun@master
+ uses: google-github-actions/deploy-cloudrun@v0
```


## Prerequisites

- This action requires Google Cloud credentials to execute gcloud commands.
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example-workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ update values to match your setup.
Learn more about [Automating your workflow with Github Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions).


[action]: https://github.com/GoogleCloudPlatform/github-actions/tree/master/setup-gcloud
[action]: https://github.com/google-github-actions/setup-gcloud
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name: Build using Cloud Build
on:
push:
branches:
- master
- 'main'

env:
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
Expand Down
8 changes: 4 additions & 4 deletions example-workflows/cloud-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ update values to match your setup.

## Workflow description

For pushes to the `master` branch, this workflow will:
For pushes to the `main` branch, this workflow will:

1. Download and configure the Google [Cloud SDK][sdk] with the provided
credentials.
Expand Down Expand Up @@ -69,14 +69,14 @@ For pushes to the `master` branch, this workflow will:
$ git commit -m "Set up GitHub workflow"
```

1. Push to the `master` branch:
1. Push to the `main` branch:

```text
$ git push -u origin master
$ git push -u origin main
```

1. View the GitHub Actions Workflow by selecting the `Actions` tab at the top
of your repository on GitHub. Then click on the `Build using Cloud Build`
of your repository on GitHub. Then click on the `Build using Cloud Build`
element to see the details.

[actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
Expand Down
2 changes: 1 addition & 1 deletion example-workflows/gce/.github/workflows/gce.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name: Build and Deploy to Google Compute Engine
on:
push:
branches:
- master
- 'main'

env:
PROJECT_ID: ${{ secrets.GCE_PROJECT }}
Expand Down
6 changes: 3 additions & 3 deletions example-workflows/gce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ update values to match your setup.

## Workflow description

For pushes to the `master` branch, this workflow will:
For pushes to the `main` branch, this workflow will:

1. Download and configure the Google [Cloud SDK][sdk] with the provided
credentials.
Expand Down Expand Up @@ -83,10 +83,10 @@ For pushes to the `master` branch, this workflow will:
$ git commit -m "Set up GitHub workflow"
```

1. Push to the `master` branch:
1. Push to the `main` branch:

```text
$ git push -u origin master
$ git push -u origin main
```

1. View the GitHub Actions Workflow by selecting the `Actions` tab at the top
Expand Down
36 changes: 0 additions & 36 deletions src/setup-gcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,6 @@ export async function run(): Promise<void> {
// Warn if pinned to HEAD
if (isPinnedToHead()) {
core.warning(pinnedToHeadWarning('v0'));

// TODO(sethvargo): remove after branch is renamed from "master" -> "main".
const envvar =
'SETUP_GCLOUD_I_UNDERSTAND_USING_MASTER_WILL_BREAK_MY_WORKFLOW_ON_2022_04_05';
const issueURL =
'https://github.com/google-github-actions/setup-gcloud/issues/539';
const isMaster = process.env.GITHUB_ACTION_REF === 'master';
const isOurs =
process.env.GITHUB_REPOSITORY_OWNER === 'google-github-actions';
const isAccepted = process.env[envvar];
if (isMaster && !(isOurs || isAccepted)) {
core.setFailed(
`On 2022-04-05, the default branch will be renamed from "master" to ` +
`"main". Your action is currently pinned to "@master". Even though ` +
`GitHub creates redirects for renamed branches, testing found that ` +
`this rename breaks existing GitHub Actions workflows that are ` +
`pinned to the old branch name.\n` +
`\n` +
`We strongly advise updating your GitHub Action YAML from:\n` +
`\n` +
` uses: 'google-github-actions/setup-gcloud@master'\n` +
`\n` +
`to:\n` +
`\n` +
` uses: 'google-github-actions/setup-gcloud@v0'\n` +
`\n` +
`While not recommended, you can still pin to the "master" branch ` +
`by setting the environment variable "${envvar}=1". However, on ` +
`2022-04-05 when the branch is renamed, all your workflows will ` +
`begin failing with an obtuse and difficult to diagnose error ` +
`message.\n` +
`\n` +
`For more information, please see: ${issueURL}`,
);
return;
}
}

core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
Expand Down