Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit 05cd2f7

Browse files
committed
Initial commit
0 parents  commit 05cd2f7

File tree

11 files changed

+576
-0
lines changed

11 files changed

+576
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
# Run it at a specific time so that we don't get emails all day long
8+
time: "00:00"
9+
open-pull-requests-limit: 10
10+
ignore:
11+
- dependency-name: "*"
12+
# GitHub actions are using git tags (v1 = v1.2 = v1.2.3) which should be compatible until a major change is performed
13+
update-types:
14+
- "version-update:semver-minor"
15+
- "version-update:semver-patch"
16+
- package-ecosystem: maven
17+
directory: "/"
18+
schedule:
19+
interval: daily
20+
# Run it at a specific time so that we don't get emails all day long
21+
time: "00:00"
22+
open-pull-requests-limit: 10
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Update from Template
2+
3+
# This workflow keeps the repo up to date with changes from the template repo (REMOTE_URL)
4+
# It duplicates the REMOTE_BRANCH (into UPDATE_BRANCH) and tries to merge it into the
5+
# this repos default branch (which is checked out here)
6+
# Note that this requires a PAT (Personal Access Token) - at best from a servicing account
7+
# Also note that you should have at least once merged the template repo into the current repo manually
8+
# otherwise a "refusing to merge unrelated histories" error might occur.
9+
10+
on:
11+
schedule:
12+
- cron: '55 2 * * 1'
13+
workflow_dispatch:
14+
15+
env:
16+
UPDATE_BRANCH: update-from-template
17+
REMOTE_URL: https://github.com/xdev-software/base-template.git
18+
REMOTE_BRANCH: master
19+
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
24+
jobs:
25+
update:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
# Required because otherwise there are always changes detected when executing diff/rev-list
32+
fetch-depth: 0
33+
# If no PAT is used the following error occurs on a push:
34+
# refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission
35+
token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }}
36+
37+
- name: Init Git
38+
run: |
39+
git config --global user.email "actions@github.com"
40+
git config --global user.name "GitHub Actions"
41+
42+
- name: Main workflow
43+
id: main
44+
run: |
45+
echo "Adding remote template-repo"
46+
git remote add template ${{ env.REMOTE_URL }}
47+
48+
echo "Fetching remote template repo"
49+
git fetch template
50+
51+
echo "Deleting local branch that will contain the updates - if present"
52+
git branch -D ${{ env.UPDATE_BRANCH }} || true
53+
54+
echo "Checking if the remote template repo has new commits"
55+
git rev-list ..template/${{ env.REMOTE_BRANCH }}
56+
57+
if [ $(git rev-list --count ..template/${{ env.REMOTE_BRANCH }}) -eq 0 ]; then
58+
echo "There are no commits new commits on the template repo"
59+
60+
echo "Deleting origin branch that contains the updates - if present"
61+
git push -f origin --delete ${{ env.UPDATE_BRANCH }} || true
62+
63+
echo "abort=1" >> $GITHUB_OUTPUT
64+
exit 0
65+
fi
66+
67+
echo "Found new commits on the template repo"
68+
69+
echo "Creating update branch"
70+
git branch ${{ env.UPDATE_BRANCH }} template/${{ env.REMOTE_BRANCH }}
71+
git branch --unset-upstream ${{ env.UPDATE_BRANCH }}
72+
73+
echo "Pushing update branch"
74+
git push -f -u origin ${{ env.UPDATE_BRANCH }}
75+
76+
echo "Getting current branch"
77+
current_branch=$(git branch --show-current)
78+
echo "Current branch is $current_branch"
79+
echo "current_branch=$current_branch" >> $GITHUB_OUTPUT
80+
81+
echo "abort=0" >> $GITHUB_OUTPUT
82+
83+
- name: pull-request
84+
uses: repo-sync/pull-request@v2
85+
if: steps.main.outputs.abort == 0
86+
with:
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
source_branch: ${{ env.UPDATE_BRANCH }}
89+
destination_branch: ${{ steps.main.outputs.current_branch }}
90+
pr_title: "Update from template"
91+
pr_body: "An automated PR to sync changes from the template into this repo"
92+

.idea/checkstyle-idea.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/saveactions_settings.xml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Whitespace-only changes.

SECURITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-addon-template/security/advisories/new).

0 commit comments

Comments
 (0)