-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
76 lines (75 loc) · 3.46 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
name: "Guru to GitHub"
description: "Sync content from Guru to GitHub"
branding:
icon: "copy"
color: "green"
inputs:
guru_collection_id:
description: "ID of the Guru Collection to sync"
deprecationMessage: "'guru_collection_id' is deprecated and will be removed in a future version. Use 'guru-collection-ids' instead."
guru-collection-ids:
description: "ID(s) of the Guru Collection(s) to sync"
collection_directory_path:
description: "Path to the directory where the Collection and metadata file should be synced to"
deprecationMessage: "'collection_directory_path' is deprecated and will be removed in a future version. Use 'collection-directory-path' instead."
collection-directory-path:
description: "Path to the directory where the Collection and metadata file should be synced to"
runs:
using: "composite"
steps:
- run: echo "GITHUB_TOKEN=${{ github.token }}" >> $GITHUB_ENV
if: ${{ !env.GITHUB_TOKEN }}
shell: bash
- uses: actions/checkout@v4
with:
lfs: true
token: ${{ env.GITHUB_TOKEN }}
- name: git config user
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Install pipenv
shell: bash
run: pip install --user pipenv
- uses: actions/setup-python@v5
with:
python-version-file: "${{ github.action_path }}/.python-version"
- name: Install dependencies
shell: bash
run: pipenv install
env:
PIPENV_PIPFILE: ${{ github.action_path }}/Pipfile
# Create the collection directory so we can use it as the working directory
# This allows us to keep the metadata file in the same directory as the collection(s)
- name: Create the collection directory if it does not exist
shell: bash
run: mkdir -p ${{ inputs.collection-directory-path || inputs.collection_directory_path }}
- run: git pull
if: ${{ !env.DRY_RUN }}
shell: bash
- name: Sync collection
working-directory: ${{ inputs.collection-directory-path || inputs.collection_directory_path }}
shell: bash
run: pipenv run python ${{ github.action_path }}/github_publisher.py
env:
PIPENV_PIPFILE: ${{ github.action_path }}/Pipfile
GURU_COLLECTION_IDS: ${{ inputs.guru-collection-ids || inputs.guru_collection_id }}
COLLECTION_DIRECTORY_PATH: ${{ inputs.collection-directory-path || inputs.collection_directory_path }}
- name: Pull changes from sync so we can update the metadata file
if: ${{ !env.DRY_RUN && !cancelled() }}
shell: bash
run: git pull
- uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0
if: ${{ !env.DRY_RUN && !cancelled() }}
with:
file_pattern: "${{ inputs.collection-directory-path || inputs.collection_directory_path }}/**/resources/*"
commit_message: "Update resources"
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
- uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0
if: ${{ !env.DRY_RUN && !cancelled() }}
with:
file_pattern: "${{ inputs.collection-directory-path || inputs.collection_directory_path }}/GitHubPublisher.json"
commit_message: "Update GitHubPublisher.json"
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"