-
Notifications
You must be signed in to change notification settings - Fork 10
4. Extras
Creating profiles can be a time-consuming process, especially if you have hundreds of profiles to add to your site. You can reduce this pain by using a GitHub action to generate the markdown and placeholder image for a profile. This allows the user to jump straight into their profile and start editing without the need to create their profile from scratch.
Figure: Postman configuration for GitHub Dispatch trigger
- Set the
POST URL
https://api.github.com/repos/_Your_GITHUB_ACCOUNT_/Northwind.People/dispatches - Add the additional headers
Accept = application/vnd.github.everest-preview+json
Authorization = token <GitHubToken>
- Ensure the original
Accept
header is disabled. Figure: JSON payload required for the automated profile generation - Create the payload for the new profile
- Send the post request to GitHub
When a profile is modified, you need to re-build SSW.People to be able to see your changes. If done manually, it could be time-consuming as you will spend time to launch the build on every change and people will chase you to get their information up to date. Luckily there is a way to automate the build on profile change.
-
Create a new secret on your Northwind.People fork called
ACCESS_TOKEN
.
The value of this secret will be your GitHub username and Personal Access Token for exampleusername:access_token
.
This will be used to allow dispatch commands to be sent to your SSW.People fork. -
Update the build and deployment workflow on your SSW.People fork.
Add the following code snippet to the on trigger of your existing build and deploy workflow.
repository_dispatch:
types: [build_and_deploy]
Your on trigger will now look something like this.
on:
repository_dispatch:
types: [build_and_deploy]
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
If there is a filter on the events that allow the build to run, you will need to add the following.
github.event.action == 'build_and_deploy' ||
Here is an example of it with the Azure Static Web App build and deploy workflow.
jobs:
build_and_deploy_job:
if: github.event.action == 'build_and_deploy' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
- Create the trigger workflow on the Northwind.People fork.
Create a new workflow with the following code, replacing<USERNAME>
with your GitHub username.
name: Trigger CI/CD when updating the repository
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run a multi-line script
run: |
curl -X POST https://api.github.com/repos/<USERNAME>/SSW.People/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "build_and_deploy", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
- Edit a file on the Northwind.People fork.
To test everything works, update a file on your Northwind.People fork.
Once the change has been pushed to your forks main branch, the workflow should run and generate a build on your SSW.People fork.
The copy feature allows users to display profile details alongside an image in a structured format. This is achieved using a combination of HTML and CSS, ensuring compatibility with email clients like Outlook as well as Word.
How to Use
-
Navigate to the Desired Employee Profile:
- Find the employee whose details you want to copy.
-
Locate the Copy Icon:
- Next to the "Download Profile Picture" icon, you'll see a new "Copy" icon.
-
Click the Copy Icon:
- This will copy the employee's details to your clipboard.
-
Paste the Details:
- Open your email client or a Word document.
-
Insert the Details:
- Right-click and select "Paste" or use the keyboard shortcut (Ctrl+V for Windows, Cmd+V for Mac) to insert the copied details.
Figure: Formatted profile info
If you need help to adapt SSW.People to your need (data source, design, new widgets for the profile page), contact SSW