-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add workflows to use as template (#4)
- Loading branch information
Showing
3 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: "2" | ||
|
||
name: %PRETTY_NAME% | ||
description: %PRETTY_NAME% | ||
|
||
service_account: | ||
display_name: %PRETTY_NAME% Bot | ||
|
||
functions: | ||
- name: extraction | ||
description: Extraction function for %PRETTY_NAME% | ||
|
||
keyring_types: | ||
- id: example-connection | ||
name: Example Connection | ||
description: Example Connection | ||
kind: "Secret" | ||
is_subdomain: true | ||
secret_config: | ||
secret_transform: ".token" # a JQ query | ||
fields: | ||
- id: token | ||
name: Token | ||
description: Example API token | ||
|
||
imports: | ||
- slug: %PROJECT_NAME% | ||
display_name: %PRETTY_NAME% | ||
description: %PRETTY_NAME% | ||
extractor_function: extraction | ||
allowed_connection_types: | ||
- example-connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Set up the repository | ||
on: | ||
push: | ||
branches: [main] | ||
jobs: | ||
cleanup: | ||
name: Set up the repository | ||
runs-on: ubuntu-latest | ||
if: github.event.repository.name != 'adaas-template' | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Replace templates | ||
run: | | ||
shopt -s dotglob | ||
export LC_CTYPE=C | ||
export LANG=C | ||
# Project name is lowercase repository name (used in configs) | ||
PROJECT_NAME="${GITHUB_REPOSITORY,,}" # Of form owner/repo | ||
PROJECT_NAME="${PROJECT_NAME##*/}" # Just the repo name | ||
# Pretty name is how it's displayed in the README (spaces and starting case) | ||
# Since it can contain spaces, it has to be escaped in the sed command | ||
PRETTY_NAME="$(echo "$PROJECT_NAME" | sed 's/-/ /g; s/\b\(.\)/\u\1/g')" | ||
ESCAPED_PRETTY_NAME="$(echo "$PRETTY_NAME" | sed 's/ /\\ /g')" | ||
echo "Project name: '$PROJECT_NAME'" | ||
echo "Pretty name: '$PRETTY_NAME'" | ||
echo "Replacing pretty name: %PRETTY_NAME% -> '$PRETTY_NAME'" | ||
find .github/templates -type f -exec sed -i "s/%PRETTY_NAME%/$ESCAPED_PRETTY_NAME/g" {} \; | ||
echo "Replacing project name: %PROJECT_NAME% -> '$PROJECT_NAME'" | ||
find .github/templates -type f -exec sed -i "s/%PROJECT_NAME%/$PROJECT_NAME/g" {} \; | ||
echo "Moving template files to the root of the repository" | ||
rm -rf manifest.yaml | ||
mv -f .github/templates/* . | ||
rm -rf .github | ||
- name: Commit | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git add . | ||
git commit --amend --no-edit | ||
- name: Push | ||
uses: ad-m/github-push-action@v0.6.0 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: main | ||
force: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters