Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahaj-IBM authored Oct 16, 2024
0 parents commit 4843084
Show file tree
Hide file tree
Showing 71 changed files with 30,034 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Site Build

on:
pull_request:
types:
- closed
branches:
- main
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
159 changes: 159 additions & 0 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Sync with GitHub Enterprise
env:
GITHUB_TOKEN: ${{ secrets.GH_ENTERPRISE_TOKEN }}
GHE_USER: ${{ vars.SYNC_USER }}
GHE_FULL_USER: ${{ vars.SYNC_USER_NAME }}
ENTERPRISE_URL: ${{ vars.ENTERPRISE_GIT_URL }}
ENTERPRISE_EMAIL: ${{ vars.SYNC_USER_EMAIL }}
DEFAULT_TEMPLATE: ${{ vars.REPO_TEMPLATE }}
COMMIT_MESSAGE: Pushing updates from Public to Enterprise
COMMIT_AUTHOR: Friendly Neighborhood CEBOT
CEBOT_GH_TRAVIS_TOKEN: ${{ secrets.CEBOT_GH_TRAVIS_TOKEN }}
CEBOT_TRAVIS_API_KEY: ${{ secrets.CEBOT_TRAVIS_API_KEY }}
TRAVIS_API_ENDPOINT: ${{ vars.TRAVIS_API_ENDPOINT }}
ENTERPRISE_PAGES_URL: ${{ vars.ENTERPRISE_PAGES_URL }}

on:
push:
branches:
- main

jobs:
verify_and_mirror:
runs-on: ubuntu-latest
steps:
- name: Check if remote enterprise repo exists
id: repocheck
run: git ls-remote https://${{ env.GHE_USER }}:${{ env.GITHUB_TOKEN }}@${{ env.ENTERPRISE_URL }}/${{ github.repository }} -q --exit-code
- name: Create remote repo
if: ${{ failure() && steps.repocheck.conclusion == 'failure' }}
run: |
echo ${{ env.GITHUB_TOKEN }} > /tmp/token.txt
gh auth login -p https -h ${{ env.ENTERPRISE_URL }} --with-token < /tmp/token.txt
gh repo create --public ${{ github.repository }}
- name: Checkout repo and all branches to stage
id: checkout
# if: ${{ failure() && steps.repocheck.conclusion == 'failure' }}
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
fetch-depth: 0

- name: Mirror the repo up to our internal github
id: mirror
# if: ${{ failure() && steps.check_directory.conclusion != 'failure' }}
uses: yesolutions/mirror-action@master
with:
REMOTE: 'https://${{ env.ENTERPRISE_URL }}/${{ github.repository }}'
GIT_USERNAME: ${{ env.GHE_USER }}
GIT_PASSWORD: ${{ env.GITHUB_TOKEN }}

- name: Set repo name as an env var
id: repo_name
# if: ${{ failure() && steps.check_directory.conclusion != 'failure' }}
run: |
echo ${{ github.repository }}| awk -F/ '{print "REPO_NAME="$2}' >> "$GITHUB_OUTPUT"
- name: Set Travis Vars
id: travis
# if: ${{ failure() && steps.check_directory.conclusion != 'failure' }}
env:
REPO_NAME: ${{ steps.repo_name.outputs.REPO_NAME }}
run: |
curl -X POST \
-H "Content-Type: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ env.CEBOT_TRAVIS_API_KEY }}" \
-d '{ "env_var.name": "ORG", "env_var.value": "${{ github.repository_owner }}", "env_var.public": true }' \
${{ env.TRAVIS_API_ENDPOINT }}/repo/${{ github.repository_owner }}%2F${{ env.REPO_NAME }}/env_vars
curl -X POST \
-H "Content-Type: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ env.CEBOT_TRAVIS_API_KEY }}" \
-d '{ "env_var.name": "REPO", "env_var.value": "${{ env.REPO_NAME }}", "env_var.public": true }' \
${{ env.TRAVIS_API_ENDPOINT }}/repo/${{ github.repository_owner }}%2F${{ env.REPO_NAME }}/env_vars
curl -X POST \
-H "Content-Type: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ env.CEBOT_TRAVIS_API_KEY }}" \
-d '{ "env_var.name": "GITHUB_TOKEN", "env_var.value": "${{ env.CEBOT_GH_TRAVIS_TOKEN }}", "env_var.public": false }' \
${{ env.TRAVIS_API_ENDPOINT }}/repo/${{ github.repository_owner }}%2F${{ env.REPO_NAME }}/env_vars
curl -X POST \
-H "Content-Type: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ env.CEBOT_TRAVIS_API_KEY }}" \
-d '{ "env_var.name": "PAGES_URL", "env_var.value": "${{ env.ENTERPRISE_PAGES_URL }}", "env_var.public": true }' \
${{ env.TRAVIS_API_ENDPOINT }}/repo/${{ github.repository_owner }}%2F${{ env.REPO_NAME }}/env_vars
# update:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Enterprise repo and all branches
# uses: actions/checkout@v4
# with:
# github-server-url: https://${{ env.GHE_USER }}@${{ env.ENTERPRISE_URL }}
# repository: ${{ github.repository }}
# token: ${{ env.GITHUB_TOKEN }}
# - name: See if dashboard directory exists and create if it doesn't
# id: check_directory
# uses: JJ/files-present-action@releases/v1
# with:
# files: 'dashboard/README.md'
# - name: No Dashboard
# if: ${{ failure() && steps.check_directory.conclusion == 'failure' }}
# run: |
# git config --local user.name ${{ env.GHE_USER }}
# git config --local user.email "${{ env.GHE_USER }}@users.noreply.github.com"
# mkdir ./dashboard
# echo "README" > ./dashboard/README.md
# git add ./dashboard
# git commit -m "Dashboard directory created!"
# git push
## git remote set-url origin https://${{ env.GHE_USER }}:${{ env.GITHUB_TOKEN }}@${{ env.ENTERPRISE_URL }}/${{ github.repository }}
## git push
## - name: Push changes # push the output folder to your repo
## if: ${{ failure() && steps.check_directory.conclusion == 'failure' }}
## uses: ad-m/github-push-action@master
### uses: justjavac/action-gh-push@v1
## with:
## GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
## repository: 'https://${{ env.ENTERPRISE_URL }}/${{ github.repository }}'
## force: true

# sync:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout our public repo
# uses: actions/checkout@v4
# with:
# repository: ${{ github.repository }}
# fetch-depth: 0
# path: public
## - name: Checkout our enterprise repo
## uses: actions/checkout@v4
## with:
## github-server-url: https://${{ env.GHE_USER }}@${{ env.ENTERPRISE_URL }}
## repository: ${{ github.repository }}
## fetch-depth: 0
## token: ${{ env.GITHUB_TOKEN }}
## path: enterprise
# - name: Clone our enterprise repo
# run: |
# git config --global user.name "${{ env.COMMIT_AUTHOR }}"
# git config --global user.email ${{ env.GHE_USER }}@users.noreply.github.com
# git clone https://${{ env.GHE_USER}}:${{ env.GITHUB_TOKEN }}@${{ env.ENTERPRISE_URL }}/${{ github.repository }}.git enterprise
# - name: Copy over all changed files from public to enterprise
# run: |
# rsync -auvr --exclude '.git' --exclude 'docusaurus.config.js' --exclude '.travis.yml' public/* enterprise
# cd enterprise
# git config --global user.name "${{ env.COMMIT_AUTHOR }}"
# git config --global user.email ${{ env.GHE_USER }}@users.noreply.github.com
# git add .
# git commit -a -m "${{ env.COMMIT_MESSAGE }}"
# - name: Push the changes to enterprise github
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ env.GITHUB_TOKEN }}
#
29 changes: 29 additions & 0 deletions .github/workflows/template-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
# cronjob trigger
schedule:
- cron: "0 0 * * 1"
# manual trigger
workflow_dispatch:
jobs:
repo-sync:
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
contents: write
pull-requests: write

steps:
# To use this repository's private action, you must check out the repository
- name: Checkout
uses: actions/checkout@v4
# https://github.com/actions/checkout#usage
# uncomment if you use submodules within the source repository
# with:
# submodules: true

- name: actions-template-sync
uses: AndreasAugustin/actions-template-sync@v2
with:
source_repo_path: ibm-client-engineering/solution-template
upstream_branch: main # defaults to main
pr_labels: template_sync # defaults to template_sync
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

*.DS_Store
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
package-lock.json

npm-debug.log*
yarn-debug.log*
yarn-error.log*
2 changes: 2 additions & 0 deletions .templatesyncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:!src/css/custom.css
*
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
language: ruby

branches:
only:
- main

#env:
# - IMAGE_TAG=latest IMAGE_NAME=angel-watson-assistant-demo IBM_REGISTRY_NAMESPACE=watson-assistant

#services:
# - docker

jobs:
include:
- stage: build and deploy pages
before_install:
- bash update_docusaurus.sh $ORG $REPO $PAGES_URL
install:
- yarn upgrade
# - yarn install --frozen-lockfile
- yarn install
script:
- yarn build
deploy:
- provider: pages
github_url: github.ibm.com
github_token: $GITHUB_TOKEN
target_branch: gh-pages
skip_cleanup: true
local_dir: build
on:
branch: main

stages:
- build and deploy pages
32 changes: 32 additions & 0 deletions CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
IBM Contributor License Agreement
=================================

Version 1.0.0 January 14, 2014

In order for You (as defined below) to make intellectual property Contributions (as defined below) now or in the future to IBM GitHub repositories,
You must agree to this Contributor License Agreement ("CLA").

Please read this CLA carefully before accepting its terms. By accepting the CLA, You are agreeing to be bound by its terms.
If You submit a Pull Request against an IBM repository on GitHub You must include in the Pull Request a statement of Your acceptance of this CLA.

As used in this CLA:
(i) "You" (or "Your") shall mean the entity that is making this Agreement with IBM;
(ii)"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is submitted by You to IBM for inclusion in,
or documentation of, any of the IBM GitHub repositories;
(iii) "Submit" (or "Submitted") means any form of communication sent to IBM (e.g. the content You post in a GitHub Issue or submit as part of a GitHub Pull Request).

This agreement applies to all Contributions You Submit.

This CLA, and the license(s) associated with the particular IBM GitHub repositories You are contributing to, provides a license to Your Contributions to IBM and downstream consumers,
but You still own Your Contributions, and except for the licenses provided for in this CLA, You reserve all right, title and interest in Your Contributions.

IBM requires that each Contribution You Submit now or in the future comply with the following four commitments.

1) You will only Submit Contributions where You have authored 100% of the content.
2) You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the
Contributions.
3) Whatever content You Contribute will be provided under the license(s) associated with the particular IBM GitHub repository You are contributing to.
4) You understand and agree that IBM GitHub repositories and Your contributions are public, and that a record of the contribution (including all personal information You submit with it)
is maintained indefinitely and may be redistributed consistent with the license(s) involved.
You will promptly notify the IBM if You become aware of any facts or circumstances that would make these commitments inaccurate in any way.
To do so, please create an Issue in the appropriate GitHub repository.
Loading

0 comments on commit 4843084

Please sign in to comment.