Skip to content

Commit

Permalink
python support and other cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrashears5 committed Aug 1, 2023
1 parent b8a99ca commit c23c38f
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 102 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/release-maker.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/stale-issues.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/sync-github-with-metadata-json.yml

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ RUN apk add git
# add jq for json parsing
RUN apk add jq

# for toml parsing
RUN apk add --no-cache yq

# add grep for xml parsing
RUN apk add grep

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<b>Github Action to sync repo metadata from code to repo</b>

[![Build Status](https://dev.azure.com/kbrashears5/github/_apis/build/status/kbrashears5.github-action-repo-sync?branchName=master)](https://dev.azure.com/kbrashears5/github/_build/latest?definitionId=27&branchName=master)
[![Repo Metadata Sync](https://github.com/kbrashears5/github-action-repo-sync/actions/workflows/repo-sync.yml/badge.svg)](https://github.com/kbrashears5/github-action-repo-sync/actions/workflows/repo-sync.yml)

</div>

Expand All @@ -19,7 +19,7 @@ name: Repo Sync
on:
push:
branches:
- master
- main
schedule:
- cron: 0 0 * * *

Expand All @@ -28,9 +28,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetching Local Repository
uses: actions/checkout@master
- name: Repo Sync
uses: kbrashears5/github-action-repo-sync@v1.0.0
uses: actions/checkout@v3
- name: Repo Metadata Sync
uses: kbrashears5/github-action-repo-sync@v2.0.0
with:
TYPE: npm
PATH: package.json
Expand All @@ -48,6 +48,7 @@ jobs:
| --- | --- | --- |
| npm | package.json | package.json for repo |
| nuget | ProjectName.csproj | csproj file for project |
| python | ProjectName.toml | toml file for project |
## Tips
For repo types that aren't listed above (like this one), you can still use this action, just have to get creative.
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Repo Metadata Sync'
description: 'Github Action to sync repo metadata from code to repo'
description: 'Github Action to sync repo metadata (description, url, and topics) from code to repo'
author: 'kbrashears5'
branding:
icon: 'upload-cloud'
Expand Down
39 changes: 0 additions & 39 deletions azure-pipelines.yml

This file was deleted.

18 changes: 17 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ echo "Username: [$USERNAME]"
REPO_NAME=${REPO_INFO[1]}
echo "Repo name: [$REPO_NAME]"

# initalize git
# initialize git
echo "Intiializing git"
git config --system core.longpaths true
git config --global core.longpaths true
Expand Down Expand Up @@ -91,6 +91,22 @@ elif [ "$REPO_TYPE" == "nuget" ]; then
TOPICS_STRING=$(grep -oP '(?<=<PackageTags>)[^<]+' "${FILE_PATH}")
TOPICS_ARRAY=$(echo $TOPICS_STRING | tr ";" "\n")
TOPICS=`printf '%s\n' "${TOPICS_ARRAY[@]}" | jq -R . | jq -s .`

elif [ "$REPO_TYPE" == "python" ]; then
echo "Repo type: Python"
# read in the variables from pyproject.toml
echo "Parsing ${FILE_PATH}"
DESCRIPTION=`yq e '.tool.poetry.description' ${FILE_PATH}`
WEBSITE=`yq e '.tool.poetry.homepage' ${FILE_PATH}`
# yq responds with `null` if nothing exists, but we want to return an empty array
TOPICS=$(
result=$(yq -ojson eval '.tool.poetry.keywords' pyproject.toml)
if [ "$result" = "null" ]; then
echo "[]"
else
echo $result
fi
)
else
echo "Unsupported repo type: [${REPO_TYPE}]"
exit 1
Expand Down

0 comments on commit c23c38f

Please sign in to comment.