Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(website): sync database #10

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/slash-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
commands: |
deploy-website
deploy-infrastructure
build-website
static-args: |
pr_number=${{ env.PR_NUMBER }}
pr_url=${{ env.PR_URL }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
name: Build Website
name: Sync Database

on:
repository_dispatch:
types:
- build-website
- build-website-command
- sync-database
workflow_dispatch:
inputs:
hash-commit-awesome-italia-opensource:
description: "Set the commit hash from awesome-italia-opensource"
required: false
default: ""
runner-id-awesome-italia-opensource:
description: "Set the runner id from awesome-italia-opensource"
required: false
default: ""

# Permissions for terramform-init action
permissions:
Expand All @@ -21,35 +24,34 @@ env:
WORKSPACE: "production"

jobs:
build-website:
sync-database:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Load env
id: env
run: |
build_pr_branch_name="feat/build-website-${{ github.event_name }}-${{ github.sha }}"
checkout_commit_sha="${{ github.sha }}"

if [ "${{ inputs.hash-commit-awesome-italia-opensource }}" != "" ] ; then
build_pr_branch_name="feat/build-website-awesome-${{ inputs.hash-commit-awesome-italia-opensource }}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ] ; then
pr_branch_name="feat/sync-database-${{ github.event_name }}-${{ github.sha }}"
pr_body="Sync database: manualy triggered by ${{ github.actor }}"
hash_commit_awesome_italia_opensource="latest"
else
pr_branch_name="feat/sync-database-${{ github.event.client_payload.hash }}"
pr_body="Sync database: triggered by [awesome-italia-opensource](https://github.com/italia-opensource/awesome-italia-opensource) (pipeline: [${{ github.event.client_payload.run_id }}](https://github.com/italia-opensource/awesome-italia-opensource/actions/runs/${{ github.event.client_payload.run_id }}))"
hash_commit_awesome_italia_opensource="${{ github.event.client_payload.hash }}"
fi

if [ "${{ github.event.client_payload.slash_command.args.named.pr_sha }}" != "" ]; then
checkout_commit_sha="${{ github.event.client_payload.slash_command.args.named.pr_sha }}"
fi
echo "pr_branch_name=${pr_branch_name}" >> $GITHUB_OUTPUT
echo "pr_branch_name=${pr_branch_name}"

echo "checkout_commit_sha=${checkout_commit_sha}" >> $GITHUB_OUTPUT
echo "checkout_commit_sha=${checkout_commit_sha}"
echo "pr_body=${pr_body}" >> $GITHUB_OUTPUT
echo "pr_body=${pr_body}"

echo "build_pr_branch_name=${build_pr_branch_name}" >> $GITHUB_OUTPUT
echo "build_pr_branch_name=${build_pr_branch_name}"
echo "hash_commit_awesome_italia_opensource=${hash_commit_awesome_italia_opensource}" >> $GITHUB_OUTPUT
echo "hash_commit_awesome_italia_opensource=${hash_commit_awesome_italia_opensource}"

- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ steps.env.outputs.checkout_commit_sha }}
fetch-depth: 0

- name: Setup Python 3.12
uses: actions/setup-python@v5
Expand Down Expand Up @@ -79,7 +81,7 @@ jobs:
id: build
timeout-minutes: 5
run: |
make download
make download HASH_COMMIT="${{ steps.env.outputs.hash_commit_awesome_italia_opensource}}"

git checkout HEAD -- infrastructure/.terraform.lock.hcl # Ignore changes to the lock file
status=$(git status -s)
Expand All @@ -102,10 +104,10 @@ jobs:
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.ACTION_WORKFLOWS }}
branch: ${{ steps.env.outputs.build_pr_branch_name }}
title: "feat(website): update awesome data"
body: "Update awesome data from: ${{ github.event_name }}"
commit-message: "Update awesome data from: ${{ github.event_name }}"
branch: ${{ steps.env.outputs.pr_branch_name }}
title: "feat(website): sync database"
body: ${{ steps.env.outputs.pr_body }}
commit-message: "feat(website): sync database"
author: "FabrizioCafolla <${{ secrets.ACTION_EMAIL }}>"
add-paths: |
website/src/*
Expand Down
5 changes: 3 additions & 2 deletions website/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _WORKDIR_WEBSITE:=$${PWD}
endif

VIRTUAL_ENV := true
HASH_COMMIT := latest

.PHONY: start
start: ## Start the development server
Expand Down Expand Up @@ -34,5 +35,5 @@ setup-website: ## Setup the project
@cd $(_WORKDIR_WEBSITE)/scripts && chmod +x setup.sh && ./setup.sh $(VIRTUAL_ENV) && cd -

.PHONY: download
download:
@cd $(_WORKDIR_WEBSITE) && chmod +x scripts/download.sh && ./scripts/download.sh && cd -
download: ## Download database from awesome-italia-opensource
@cd $(_WORKDIR_WEBSITE) && chmod +x scripts/download.sh && ./scripts/download.sh $(HASH_COMMIT) && cd -
60 changes: 30 additions & 30 deletions website/database/communities.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"autogenerated": {
"filename": "codemotion.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -43,7 +43,7 @@
],
"autogenerated": {
"filename": "continuous-delivery.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -67,7 +67,7 @@
],
"autogenerated": {
"filename": "devmarche.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -88,7 +88,7 @@
],
"autogenerated": {
"filename": "developers-italia.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -112,7 +112,7 @@
],
"autogenerated": {
"filename": "edo.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -135,7 +135,7 @@
],
"autogenerated": {
"filename": "fabio-biondi.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -159,7 +159,7 @@
],
"autogenerated": {
"filename": "flutter-italia.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -180,7 +180,7 @@
],
"autogenerated": {
"filename": "gitbar.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -204,7 +204,7 @@
],
"autogenerated": {
"filename": "giuppi-dev.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -230,7 +230,7 @@
],
"autogenerated": {
"filename": "grusp.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -257,7 +257,7 @@
],
"autogenerated": {
"filename": "hr-feat-ict.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -283,7 +283,7 @@
],
"autogenerated": {
"filename": "italian-linux-society.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -309,7 +309,7 @@
],
"autogenerated": {
"filename": "kcd-italy.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -331,7 +331,7 @@
],
"autogenerated": {
"filename": "kubernetes-it.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -352,7 +352,7 @@
],
"autogenerated": {
"filename": "la-locanda-del-tech.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -374,7 +374,7 @@
],
"autogenerated": {
"filename": "latina-in-tech.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -396,7 +396,7 @@
],
"autogenerated": {
"filename": "marca-user-group.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -416,7 +416,7 @@
],
"autogenerated": {
"filename": "need-for-nerd.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -437,7 +437,7 @@
],
"autogenerated": {
"filename": "open-source-support.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -460,7 +460,7 @@
],
"autogenerated": {
"filename": "red-hot-cyber.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -480,7 +480,7 @@
],
"autogenerated": {
"filename": "ripsters.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -500,7 +500,7 @@
],
"autogenerated": {
"filename": "schrodinger-hat.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -524,7 +524,7 @@
],
"autogenerated": {
"filename": "sistemista-italiano.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand Down Expand Up @@ -553,7 +553,7 @@
],
"autogenerated": {
"filename": "startup-checklist.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -580,7 +580,7 @@
],
"autogenerated": {
"filename": "startup-italia.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -603,7 +603,7 @@
],
"autogenerated": {
"filename": "twc-italia.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -627,7 +627,7 @@
],
"autogenerated": {
"filename": "techcompenso.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
},
Expand All @@ -650,7 +650,7 @@
],
"autogenerated": {
"filename": "vita-nello-zaino.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": false
}
},
Expand All @@ -671,13 +671,13 @@
],
"autogenerated": {
"filename": "fullremote-it.json",
"timestamp": "2024-06-01T21:08:07Z",
"timestamp": "2024-06-02T21:52:14Z",
"partnership": true
}
}
],
"metadata": {
"total": 29,
"update_at": "2024-06-01T21:08:07Z"
"update_at": "2024-06-02T21:52:14Z"
}
}
Loading
Loading