Skip to content

Commit

Permalink
Merge dependabot/npm_and_yarn/playground/typescript-eslint/eslint-plu…
Browse files Browse the repository at this point in the history
…gin-6.19.1 into combined-bot-prs-branch-2023-01-23
  • Loading branch information
github-actions[bot] authored Jan 23, 2024
2 parents 4554bcc + 34caa45 commit 6adb115
Show file tree
Hide file tree
Showing 48 changed files with 3,552 additions and 561 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ updates:
labels:
- "dependencies"
commit-message:
prefix: "bot"
prefix: "bot"
2 changes: 1 addition & 1 deletion .github/workflows/build-then-deploy-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Terraform validation
run: terraform validate -no-color

- name: List workspaces
- name: List workspaces
run: ls workspaces

- name: Terraform Apply
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/combine-bot-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ on:
default: 'dependabot'

mustBeGreen:
description: 'Only combine PRs that are green (status is success). Set to false if repo does not run checks'
description: 'Only combine PRs that are green (status is success). Keep false if repo does not run checks'
type: boolean
required: true
default: true
default: false

combineBranchName:
description: 'Name of the branch to combine PRs into'
Expand All @@ -35,7 +35,7 @@ on:
ignoreLabel:
description: 'Exclude PRs with this label'
required: true
default: 'nocombine'
default: 'DO NOT MERGE'

jobs:
combine-bot-prs:
Expand All @@ -44,12 +44,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/github-script@v6
- name: Set current date as env variable
run: echo "CURRENT_DATE=$(date +'%d-%m-%Y')" >> ${GITHUB_ENV}

- name: Create combined pr
id: create-combined-pr

name: Create combined pr

uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -66,7 +66,7 @@ jobs:
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched prefix: ' + branch);
let statusOK = true;
if(${{ github.event.inputs.mustBeGreen }}) {
if (${{ github.event.inputs.mustBeGreen }}) {
console.log('Checking green status: ' + branch);
const stateQuery = `query($owner: String!, $repo: String!, $pull_number: Int!) {
repository(owner: $owner, name: $repo) {
Expand All @@ -92,25 +92,28 @@ jobs:
const [{ commit }] = result.repository.pullRequest.commits.nodes;
const state = commit.statusCheckRollup.state
console.log('Validating status: ' + state);
if(state != 'SUCCESS') {
if (state != 'SUCCESS') {
console.log('Discarding ' + branch + ' with status ' + state);
statusOK = false;
}
}
console.log('Checking labels: ' + branch);
const labels = pull['labels'];
for(const label of labels) {
for (const label of labels) {
const labelName = label['name'];
console.log('Checking label: ' + labelName);
if(labelName == '${{ github.event.inputs.ignoreLabel }}') {
if (labelName == '${{ github.event.inputs.ignoreLabel }}') {
console.log('Discarding ' + branch + ' with label ' + labelName);
statusOK = false;
}
}
if (statusOK) {
console.log('Adding branch to array: ' + branch);
const prString = '#' + pull['number'] + ' ' + pull['title'];
branchesAndPRStrings.push({ branch, prString });
branchesAndPRStrings.push({
branch,
prString
});
baseBranch = pull['base']['ref'];
baseBranchSHA = pull['base']['sha'];
}
Expand All @@ -135,7 +138,7 @@ jobs:
let combinedPRs = [];
let mergeFailedPRs = [];
for(const { branch, prString } of branchesAndPRStrings) {
for (const { branch, prString } of branchesAndPRStrings) {
try {
await github.rest.repos.merge({
owner: context.repo.owner,
Expand All @@ -153,15 +156,15 @@ jobs:
console.log('Creating combined PR');
const combinedPRsString = combinedPRs.join('\n');
let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString;
if(mergeFailedPRs.length > 0) {
let body = '✅ This PR was created by combining the following PRs:\n' + combinedPRsString;
if (mergeFailedPRs.length > 0) {
const mergeFailedPRsString = mergeFailedPRs.join('\n');
body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString
}
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'bot: Combined PRs',
title: 'bot: Update dependencies (bulk dependabot PRs) ${CURRENT_DATE}',
head: '${{ github.event.inputs.combineBranchName }}',
base: baseBranch,
body: body
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-then-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ jobs:
github.event_name == 'pull_request' &&
github.base_ref == 'develop'
run: >
${GOPATH}/bin/benchstat -html -alpha 1.1 develop.txt current.txt | sed -n "/<body>/,/<\/body>/p" > comparison.html &&
${GOPATH}/bin/benchstat -html -alpha 1.1 develop.txt current.txt |
sed -n "/<body>/,/<\/body>/p" > comparison.html &&
./tools/scripts/pretty-benchstat-html.sh comparison.html > pretty-comparison.md
- name: Comment Benchmark Results on PR
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ permissions:
contents: read

jobs:
lint:
name: Lint job
lint-go:
name: Lint GoLang job

runs-on: ubuntu-latest

Expand All @@ -39,9 +39,8 @@ jobs:
go-version: "1.21"
check-latest: true

- name: Check linting through golangci-lint
- name: Run golangci-lint linter
uses: golangci/golangci-lint-action@v3

with:
# Required: the version of golangci-lint is required.
# Note: The version should not pick the patch version as the latest patch
Expand All @@ -68,3 +67,18 @@ jobs:
# anyways so there shouldn't be any linter errors anyways. The enforces us to
# always have a clean lint state.
only-new-issues: false

lint-yaml:
name: Lint YAML job

runs-on: ubuntu-latest

steps:
- name: Checkout code into the directory
uses: actions/checkout@v3

- name: Run yamllint linter
uses: ibiqlik/action-yamllint@v3
with:
config_file: tools/configs/yamllint.yaml
file_or_dir: .
2 changes: 1 addition & 1 deletion .github/workflows/preview-ami-with-terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ jobs:
if: steps.terraform-plan.outcome == 'failure'
run: exit 1

- name: List workspaces
- name: List workspaces
run: ls workspaces
84 changes: 60 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,63 +28,77 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code into the directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go environment explicitly
uses: actions/setup-go@v3
with:
go-version: "1.21"
check-latest: true
cache: true

- name: Apply tag
run: git tag ${{ github.event.inputs.tag }}

- name: Build modules
run: make deps:modules

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
if: matrix.os == 'ubuntu-latest'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v2
if: matrix.os == 'ubuntu-latest'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Go environment explicitly
uses: actions/setup-go@v3
with:
go-version: "1.21"
check-latest: true
cache: true
- name: Run command to get SHA environment
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV}

- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v4
# Note: These saves don't actually happen right away, as if you notice there is
# no `dist` directory, when these are executed. The caching actually happens after
# the goreleaser is ran which populates the `dist` directory, which is then picked
# up in the job cleaning step that is ran end of this job. The step is a post-caching
# cleanup step which notices the target directory is now populated and caches it.
- name: Save cache on Linux
if: matrix.os == 'ubuntu-latest'
uses: actions/cache/save@v4
with:
path: dist/linux_amd64
key: linux-${{ env.sha_short }}
- uses: actions/cache@v4

- name: Save cache on MacOS
if: matrix.os == 'macos-latest'
uses: actions/cache/save@v4
with:
path: dist/darwin_amd64
key: darwin-${{ env.sha_short }}
- uses: actions/cache@v4

- name: Save cache on Windows
if: matrix.os == 'windows-latest'
uses: actions/cache/save@v4
with:
path: dist/windows_amd64
key: windows-${{ env.sha_short }}
enableCrossOsArchive: true

# This is the step that actually `populates` the `dist` directory.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand All @@ -95,12 +109,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
# Cacheing actually happens, about here (once the above is ran).

release:
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: actions/checkout@v3
- name: Checkout code into the directory
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -120,27 +136,47 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# copy the cashes from prepare
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v4
- name: Run command to get SHA environment
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV}

# Restore the cashes that were prepared for all OS
- name: Restore from cache on Linux
id: restore-linux
uses: actions/cache/restore@v4
with:
path: dist/linux_amd64
key: linux-${{ env.sha_short }}
- uses: actions/cache@v4
fail-on-cache-miss: true

- name: Save from cache on MacOS
id: restore-macos
uses: actions/cache/restore@v4
with:
path: dist/darwin_amd64
key: darwin-${{ env.sha_short }}
- uses: actions/cache@v4
fail-on-cache-miss: true

- name: Restore from cache on Windows
id: restore-windows
uses: actions/cache/restore@v4
with:
path: dist/windows_amd64
key: windows-${{ env.sha_short }}
fail-on-cache-miss: true
enableCrossOsArchive: true

# Technically the following should never happen as we are using the `fail-on-cache-miss=true`
# so it would fail before reaching here, but leaving for now incase the option is removed.
- name: Exit if failed to restore cache for any OS
if: |
steps.restore-linux.outputs.cache-hit != 'true' ||
steps.restore-macos.outputs.cache-hit != 'true' ||
steps.restore-windows.outputs.cache-hit != 'true'
run: exit 1

# release
- uses: goreleaser/goreleaser-action@v5
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
- name: Do the release, only if all OS caches were restored
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser-pro
version: latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-upload-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:

needs: run-tests

# Important to know:
# Important to know:
# - We didn't use `if: always()` here, so this job doesn't run if we manually canceled.
# - `if: success()` is always implied unless `always()` or `failure()` is specified.
if: success() || failure()
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/validate-containerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ jobs:

- name: Test Docker image
run: docker run --rm ${{ env.TEST_TAG }}

Loading

0 comments on commit 6adb115

Please sign in to comment.