Skip to content

Commit

Permalink
feat: add option to perform a dry run sync
Browse files Browse the repository at this point in the history
  • Loading branch information
parkerbxyz committed Oct 18, 2023
1 parent e45e81a commit 8fc51f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ Each Collection will exist as a subdirectory in the directory specified by `coll

> [!NOTE]
> If a Card that was previously published to GitHub becomes unverified, the corresponding Markdown file will not be deleted. However, it will not be updated until the Card is verified.

### `DRY_RUN`

**Optional:** If truthy, the action will run without publishing any Guru Cards. This can be useful for testing.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ runs:
GURU_COLLECTION_ID: ${{ inputs.guru_collection_id }}
COLLECTION_DIRECTORY_PATH: ${{ inputs.collection_directory_path }}
- name: Pull changes from sync so we can update the metadata file
if: ${{ !env.DRY_RUN }}
shell: bash
run: git pull
- uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0
if: ${{ !env.DRY_RUN }}
with:
file_pattern: "${{ 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 }}
with:
file_pattern: "${{ inputs.collection_directory_path }}/GitHubPublisher.json"
commit_message: "Update GitHubPublisher.json"
Expand Down
3 changes: 2 additions & 1 deletion github_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class GitHubPublisher(guru.PublisherFolders):

def __init__(self, source):
super().__init__(source)
# self.dry_run = True
if environ.get("PUBLISH_UNVERIFIED_CARDS"):
self.skip_unverified_cards = False
if environ.get("DRY_RUN"):
self.dry_run = True

def get_headers(self, media_type="application/vnd.github+json"):
"""
Expand Down

0 comments on commit 8fc51f3

Please sign in to comment.