Skip to content

Commit

Permalink
Merge dependabot/npm_and_yarn/nock-13.5.3 into combined-prs-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Feb 19, 2024
2 parents a6e929f + ebe99f2 commit 5977db1
Show file tree
Hide file tree
Showing 170 changed files with 14,234 additions and 37,694 deletions.
18 changes: 18 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100,
"safari": 15,
"firefox": 91
}
}
],
"@babel/preset-typescript",
["@babel/preset-react", {"runtime": "automatic"}]
],
"plugins": []
}
4 changes: 4 additions & 0 deletions .env.acceptance
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ REACT_APP_HOST_TON=https://acc.ton.amsterdam.nl/

# Keycloak
REACT_APP_KEYCLOAK_REALM=datapunt-ad-acc

# Sentry
REACT_APP_SENTRY_PROJECT_NAME=zaken-frontend
REACT_APP_SENTRY_DSN=https://f667fd1828ec8f0c074f59f8bb3dd595@sentry.data.amsterdam.nl/10
5 changes: 1 addition & 4 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
# Add any local changes to `.env.development.local` so they won't be committed

# Local API
# REACT_APP_API_HOST=http://localhost:8080/
REACT_APP_API_HOST=https://acc.api.wonen.zaken.amsterdam.nl/
REACT_APP_API_HOST=http://localhost:8080/
REACT_APP_API_PATH=api/v1/
# Acceptance API
# REACT_APP_API_HOST=https://acc.api.wonen.zaken.amsterdam.nl/

# AZA
REACT_APP_AZA_FE=https://acc.wonen.zaken.amsterdam.nl/
Expand Down
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ REACT_APP_HOST_TON=https://ton.amsterdam.nl/

# Sentry
REACT_APP_SENTRY_PROJECT_NAME=zaken-frontend
REACT_APP_SENTRY_DSN=https://316bc441aa174156bff4cbc4230fede3@sentry.data.amsterdam.nl/50
REACT_APP_SENTRY_DSN=https://f667fd1828ec8f0c074f59f8bb3dd595@sentry.data.amsterdam.nl/10

# Keycloak
REACT_APP_KEYCLOAK_REALM=datapunt-ad
Expand Down
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
plugins: ["unused-imports"],
extends: [
"react-app"
],
Expand All @@ -15,7 +14,6 @@ module.exports = {
"space-infix-ops": ["error"],
"semi": ["error", "never"],
"template-curly-spacing": ["error", "always"],
"unused-imports/no-unused-imports": "warn",
"react/jsx-indent-props": ["error", 2],
"react/jsx-indent" : ["error", 2],

Expand Down
152 changes: 152 additions & 0 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: 'Combine PRs'

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: 'Branch prefix to find combinable PRs based on'
required: true
default: 'dependabot'
mustBeGreen:
description: 'Only combine PRs that are green (status is success). Set to false if repo does not run checks'
type: boolean
required: true
default: true
combineBranchName:
description: 'Name of the branch to combine PRs into'
required: true
default: 'combine-prs-branch'
ignoreLabel:
description: 'Exclude PRs with this label'
required: true
default: 'nocombine'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "combine-prs"
combine-prs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/github-script@v6
id: create-combined-pr
name: Create Combined PR
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
owner: context.repo.owner,
repo: context.repo.repo
});
let branchesAndPRStrings = [];
let baseBranch = null;
let baseBranchSHA = null;
for (const pull of pulls) {
const branch = pull['head']['ref'];
console.log('Pull for branch: ' + branch);
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched prefix: ' + branch);
let statusOK = true;
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) {
pullRequest(number:$pull_number) {
commits(last: 1) {
nodes {
commit {
statusCheckRollup {
state
}
}
}
}
}
}
}`
const vars = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull['number']
};
const result = await github.graphql(stateQuery, vars);
const [{ commit }] = result.repository.pullRequest.commits.nodes;
const state = commit.statusCheckRollup.state
console.log('Validating status: ' + state);
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) {
const labelName = label['name'];
console.log('Checking label: ' + labelName);
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 });
baseBranch = pull['base']['ref'];
baseBranchSHA = pull['base']['sha'];
}
}
}
if (branchesAndPRStrings.length == 0) {
core.setFailed('No PRs/branches matched criteria');
return;
}
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}',
sha: baseBranchSHA
});
} catch (error) {
console.log(error);
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
return;
}
let combinedPRs = [];
let mergeFailedPRs = [];
for(const { branch, prString } of branchesAndPRStrings) {
try {
await github.rest.repos.merge({
owner: context.repo.owner,
repo: context.repo.repo,
base: '${{ github.event.inputs.combineBranchName }}',
head: branch,
});
console.log('Merged branch ' + branch);
combinedPRs.push(prString);
} catch (error) {
console.log('Failed to merge branch ' + branch);
mergeFailedPRs.push(prString);
}
}
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) {
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: 'Combined PR',
head: '${{ github.event.inputs.combineBranchName }}',
base: baseBranch,
body: body
});
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install
run: npm install
Expand All @@ -26,7 +28,7 @@ jobs:
if: ${{ github.actor != 'dependabot[bot]' }}
uses: cypress-io/github-action@v4
with:
record: true
record: false
start: npm start
wait-on: "http://localhost:2999/"
env:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/mirror-to-azure-devops.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mirror to Azure DevOps

on:
push:
branches:
- master

jobs:
mirror:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Push to Azure DevOps
env:
AZURE_DEVOPS_REPO_URL_PAT: ${{ secrets.AZURE_DEVOPS_REPO_URL_PAT }}
run: |
git remote add azure-devops $AZURE_DEVOPS_REPO_URL_PAT
git push azure-devops master
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM node:12 AS builder
ARG NODE_VERSION=20
# Use the official Node.js image as the builder stage.
# "alpine" refers to a lightweight Linux distribution based on musl libc and BusyBox,
# known for its small size and efficiency.
FROM node:$NODE_VERSION-alpine AS builder

ARG COMMIT_HASH

Expand All @@ -25,8 +29,14 @@ RUN mv $DIR/build/* $DIR/builds/production/
RUN npm run build:acc
RUN mv $DIR/build/* $DIR/builds/acceptance/

# Use the official Nginx image as the final stage
FROM nginx:stable-alpine

# Copy the nginx configuration
ADD nginx.conf /etc/nginx/nginx.conf

# Copy the build artifacts from the builder stage
COPY --from=builder /var/www/builds /var/www

# Start nginx
CMD nginx -g 'daemon off;'
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ A `npm run deploy:prod` convenience script is also available. This also guarante
## E2E testing with Cypress

[README.md](https://github.com/Amsterdam/zaken-frontend/blob/master/cypress/README.md)


46 changes: 0 additions & 46 deletions README_CRA.md

This file was deleted.

4 changes: 2 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { defineConfig } from "cypress"
export default defineConfig({
projectId: "tbpt8b",
chromeWebSecurity: false,
screenshotOnRunFailure: true,
video: true,
screenshotOnRunFailure: false,
video: false,
viewportWidth: 1280,
viewportHeight: 1024,
defaultCommandTimeout: 10000,
Expand Down
Loading

0 comments on commit 5977db1

Please sign in to comment.