Skip to content

Commit

Permalink
Add workflows to main branch. Move script to own repo
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamXweb committed Jul 25, 2023
1 parent bb6478f commit bd9272d
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Add Issues to Airtable from Github

on:
workflow_dispatch: # Manual dispatch
schedule:
# Hourly
- cron: "0 * * * *"

jobs:
syncissues:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
- name: Syncing Issues from Github to Airtable
run: npm run issues
env:
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
AIRTABLE_BASE_ID: ${{ secrets.AIRTABLE_BASE_ID }}
AIRTABLE_TABLE_ID_ISSUES: ${{ secrets.AIRTABLE_TABLE_ID_ISSUES }}
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}
- name: Add Issues To GitHub projects
uses: actions/[email protected]
66 changes: 66 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This is a basic workflow to help you get started with Actions

name: Rebuild awesome aussie README.md

on:
push:
branches: "main"
workflow_dispatch: # Manual dispatch
schedule:
# Daily at midnight utc
- cron: "0 0 * * *"


# 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 "build"
build:
# 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:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "14.x"
- name: Install Dependencies
run: npm install
- name: Build README from Airtable
run: npm run readme
env:
AIRTABLE_API_KEY: ${{secrets.AIRTABLE_API_KEY}}
AIRTABLE_BASE_ID: ${{ secrets.AIRTABLE_BASE_ID }}
- name: Build EXTENDED list from Airtable
run: npm run extended
env:
AIRTABLE_API_KEY: ${{secrets.AIRTABLE_API_KEY}}
AIRTABLE_BASE_ID: ${{ secrets.AIRTABLE_BASE_ID }}

# Remove unwanted items
- name: Removing workflows and other items
run: |
rm -rf .github/workflows
rm -rf issues
rm -rf readme
rm package.json
rm package-lock.json
rm .gitignore
rm -rf node_modules
git config user.name "AdamXbot"
git config user.email '[email protected]'
git add .
msg="rebuilding readme from airtable for $(date)"
git commit -m "$msg"
# Create pull request of changes to main branch
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
branch: airtable-updates/patch
delete-branch: true
title: '[BUILD] Daily update readme from Airtable workflow'
base: main
author: AdamXbot <[email protected]>
reviewers: AdamXweb
19 changes: 19 additions & 0 deletions .github/workflows/sync-mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Pushes the contents of the repo to the Codeberg mirror
name: Mirror to Codeberg
on:
push:
branches: [ 'main', 'airtable' ]
workflow_dispatch: # Manual dispatch
schedule:
- cron: '0 6 * * 3'
jobs:
codeberg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: pixta-dev/repository-mirroring-action@v1
with:
target_repo_url: "[email protected]:adamxweb/awesome-aussie.git"
ssh_private_key: ${{ secrets.BOT_SSH }}
29 changes: 29 additions & 0 deletions .github/workflows/sync-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Sync main to Website
on:
workflow_run:
workflows: ["Rebuild awesome aussie README.md"]
branches: ['main', 'airtable']
types:
- completed

jobs:
sync-branches:
runs-on: ubuntu-latest
name: Syncing branches
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Opening pull request
id: pull
uses: tretuna/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FROM_BRANCH: main
TO_BRANCH: gh-pages
PULL_REQUEST_TITLE: '[AUTO] Update docs site'
PULL_REQUEST_BODY: |
Merging main into gh-pages, to be deployed to [awesome-aussie.com](https://awesome-aussie.com/).
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "aussie-gh-airtable",
"version": "0.1.0",
"description": "Awesome Aussie's Github and Airtable integrations.",
"dependencies": {
"@octokit/core": "^3.2.4",
"@octokit/plugin-paginate-rest": "^2.6.2",
"@octokit/rest": "^18.0.12",
"airtable": "^0.10.1",
"dotenv": "^8.2.0",
"readme-airtable": "^0.1.2"
},
"scripts": {
"issues": "node node_modules/readme-airtable/issues/app.js",
"readme": "node node_modules/readme-airtable/readme/app.js",
"extended": "node node_modules/readme-airtable/readme/extended.js"
},
"author": "@adamxweb",
"license": "CC0-1.0",
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/AdamXweb/awesome-aussie.git"
},
"keywords": [
"awesome",
"aussie"
],
"bugs": {
"url": "https://github.com/AdamXweb/awesome-aussie/issues"
},
"homepage": "https://github.com/AdamXweb/awesome-aussie#readme"
}

0 comments on commit bd9272d

Please sign in to comment.