Skip to content

Commit

Permalink
Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryRyumin committed Jan 12, 2024
1 parent 13040ff commit 6a016ac
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 18 deletions.
136 changes: 136 additions & 0 deletions .github/workflows/copy_parse_markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Copy Parse Markdown and Generate JSON from Source Repo

on:
workflow_dispatch:
inputs:
source_repo:
description: 'Source repository name'
required: false
default: 'DmitryRyumin/NewEraAI-Papers'
source_file_path:
description: 'Path to the file in the source repository'
required: false
default: 'code/markdown_to_json_parser.py'
code_directory:
description: 'Directory where code is stored'
required: false
default: 'code'
display_file_contents:
description: 'Whether or not to display the contents of the doanload file and the destination file'
required: false
default: 'false'
schedule:
- cron: '30 23 * * *'

jobs:
copy-code:
runs-on: ubuntu-latest

permissions:
contents: write

env:
SOURCE_FILE_PATH: ${{ github.workspace }}/${{ github.event.inputs.code_directory }}/markdown_to_json_parser_new.py
SOURCE_DESTINATION_FILE_PATH: ${{ github.workspace }}/${{ github.event.inputs.source_file_path }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
continue-on-error: true # Continue with the workflow even if the checkout fails
with:
ref: ${{ github.event.before || 'main' }}

- name: Define show_file_content function
run: echo 'source ${{ github.workspace }}/scripts/show_file_content.sh' > show_file_content_step.sh

- name: Download source file
run: |
if mkdir -p "${{ github.workspace }}/${{ github.event.inputs.code_directory }}"; then
echo "Directory created successfully or already existed."
else
echo "Failed to create directory."
exit 1
fi
source_url="https://raw.githubusercontent.com/${{ github.event.inputs.source_repo }}/main/${{ github.event.inputs.source_file_path }}"
if curl -o "${{ env.SOURCE_FILE_PATH }}" "$source_url"; then
echo "Source file downloaded successfully."
else
echo "Failed to download source file."
exit 1
fi
- name: Display content of the downloaded source file
run: |
set -e
source show_file_content_step.sh
show_file_content "${{ env.SOURCE_FILE_PATH }}" "${{ github.event.inputs.display_file_contents }}"
- name: Display content of destination file from target repository
run: |
set -e
source show_file_content_step.sh
show_file_content "${{ env.SOURCE_DESTINATION_FILE_PATH }}" "${{ github.event.inputs.display_file_contents }}"
- name: Compare and handle files
run: |
set -e
handle_equal_files() {
echo "Files are equal. Deleting SOURCE_FILE_PATH."
if rm "${{ env.SOURCE_FILE_PATH }}"; then
echo "SOURCE_FILE_PATH deleted successfully."
else
echo "Failed to delete SOURCE_FILE_PATH."
exit 1
fi
}
handle_unequal_files() {
echo "Files are not equal. Replacing SOURCE_DESTINATION_FILE_PATH with content from SOURCE_FILE_PATH."
if cat "${{ env.SOURCE_FILE_PATH }}" > "${{ env.SOURCE_DESTINATION_FILE_PATH }}"; then
echo "SOURCE_DESTINATION_FILE_PATH replaced successfully."
rm "${{ env.SOURCE_FILE_PATH }}"
else
echo "Failed to replace SOURCE_DESTINATION_FILE_PATH."
exit 1
fi
}
handle_missing_destination() {
echo "SOURCE_DESTINATION_FILE_PATH does not exist. Renaming SOURCE_FILE_PATH to SOURCE_DESTINATION_FILE_PATH."
if [ -f "${{ env.SOURCE_FILE_PATH }}" ] && [ -f "${{ env.SOURCE_DESTINATION_FILE_PATH }}" ]; then
if mv "${{ env.SOURCE_FILE_PATH }}" "${{ env.SOURCE_DESTINATION_FILE_PATH }}"; then
echo "Files renamed successfully."
else
echo "Failed to rename files."
exit 1
fi
else
echo "One or both of the files do not exist."
fi
}
if [ -f "${{ env.SOURCE_DESTINATION_FILE_PATH }}" ]; then
if cmp -s "${{ env.SOURCE_DESTINATION_FILE_PATH }}" "${{ env.SOURCE_FILE_PATH }}"; then
handle_equal_files
else
handle_unequal_files
fi
else
handle_missing_destination
fi
- name: Display working code directory content
run: |
ls -al "${{ github.workspace }}/${{ github.event.inputs.code_directory }}"
- name: Auto commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Copy Parse Markdown and Generate JSON from Source Repo'
env:
PAPER_TOKEN: ${{ secrets.PAPER_TOKEN }}

- name: Set output status
run: echo "status=${{ steps.parse.outcome }}" >> $GITHUB_ENV
72 changes: 54 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,59 @@
# ICCV-2023-Papers

[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg?style=flat)](https://github.com/sindresorhus/awesome)
[![Conference](http://img.shields.io/badge/ICCV-2023-7395C5.svg)](https://iccv2023.thecvf.com)
![Version](https://img.shields.io/badge/version-v1.0.0-rc0)
![GitHub repo size](https://img.shields.io/github/repo-size/DmitryRyumin/ICCV-2023-Papers)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=flat)](https://github.com/DmitryRyumin/ICCV-2023-Papers/blob/main/LICENSE)
[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/DmitryRyumin/ICCV-2023-Papers/blob/main/README.md)
![GitHub contributors](https://img.shields.io/github/contributors/dmitryryumin/ICCV-2023-Papers)
![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/t/dmitryryumin/ICCV-2023-Papers)
![GitHub closed issues](https://img.shields.io/github/issues-closed/DmitryRyumin/ICCV-2023-Papers)
![GitHub issues](https://img.shields.io/github/issues/DmitryRyumin/ICCV-2023-Papers)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/DmitryRyumin/ICCV-2023-Papers)
![GitHub pull requests](https://img.shields.io/github/issues-pr/dmitryryumin/ICCV-2023-Papers)
![GitHub last commit](https://img.shields.io/github/last-commit/DmitryRyumin/ICCV-2023-Papers)
![GitHub watchers](https://img.shields.io/github/watchers/dmitryryumin/ICCV-2023-Papers?style=flat)
![GitHub forks](https://img.shields.io/github/forks/dmitryryumin/ICCV-2023-Papers?style=flat)
![GitHub Repo stars](https://img.shields.io/github/stars/dmitryryumin/ICCV-2023-Papers?style=flat)
![Visitors](https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fgithub.com%2FDmitryRyumin%2FICCV-2023-Papers&label=Visitors&countColor=%23263759&style=flat)
[![Parse Markdown and Generate JSON](https://github.com/DmitryRyumin/ICCV-2023-Papers/actions/workflows/parse_markdown.yml/badge.svg)](https://github.com/DmitryRyumin/ICCV-2023-Papers/actions/workflows/parse_markdown.yml)
<table>
<tr>
<td><strong>General Information</strong></td>
<td>
<a href="https://github.com/sindresorhus/awesome">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome">
</a>
<a href="https://iccv2023.thecvf.com">
<img src="http://img.shields.io/badge/ICCV-2023-7395C5.svg" alt="Conference">
</a>
<img src="https://img.shields.io/badge/version-v1.0.0-rc0" alt="Version">
<img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT">
</td>
</tr>
<tr>
<td><strong>Repository Size and Activity</strong></td>
<td>
<img src="https://img.shields.io/github/repo-size/DmitryRyumin/ICCV-2023-Papers" alt="GitHub repo size">
<img src="https://img.shields.io/github/commit-activity/t/dmitryryumin/ICCV-2023-Papers" alt="GitHub commit activity (branch)">
</td>
</tr>
<tr>
<td><strong>Contribution Statistics</strong></td>
<td>
<img src="https://img.shields.io/github/contributors/dmitryryumin/ICCV-2023-Papers" alt="GitHub contributors">
<img src="https://img.shields.io/github/issues-closed/DmitryRyumin/ICCV-2023-Papers" alt="GitHub closed issues">
<img src="https://img.shields.io/github/issues/DmitryRyumin/ICCV-2023-Papers" alt="GitHub issues">
<img src="https://img.shields.io/github/issues-pr-closed/DmitryRyumin/ICCV-2023-Papers" alt="GitHub closed pull requests">
<img src="https://img.shields.io/github/issues-pr/dmitryryumin/ICCV-2023-Papers" alt="GitHub pull requests">
</td>
</tr>
<tr>
<td><strong>Other Metrics</strong></td>
<td>
<img src="https://img.shields.io/github/last-commit/DmitryRyumin/ICCV-2023-Papers" alt="GitHub last commit">
<img src="https://img.shields.io/github/watchers/dmitryryumin/ICCV-2023-Papers?style=flat" alt="GitHub watchers">
<img src="https://img.shields.io/github/forks/dmitryryumin/ICCV-2023-Papers?style=flat" alt="GitHub forks">
<img src="https://img.shields.io/github/stars/dmitryryumin/ICCV-2023-Papers?style=flat" alt="GitHub Repo stars">
<img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fgithub.com%2FDmitryRyumin%2FICCV-2023-Papers&label=Visitors&countColor=%23263759&style=flat" alt="Visitors">
</td>
</tr>
<tr>
<td><strong>GitHub Actions</strong></td>
<td>
<a href="https://github.com/DmitryRyumin/ICCV-2023-Papers/actions/workflows/copy_parse_markdown.yml/badge.svg">
<img src="https://github.com/DmitryRyumin/ICCV-2023-Papers/actions/workflows/copy_parse_markdown.yml/badge.svg" alt="Copy Parse Markdown and Generate JSON from Source Repo">
</a>
<br />
<a href="https://github.com/DmitryRyumin/ICCV-2023-Papers/actions/workflows/parse_markdown.yml/badge.svg?branch=main">
<img src="https://github.com/DmitryRyumin/ICCV-2023-Papers/actions/workflows/parse_markdown.yml/badge.svg?branch=main" alt="Parse Markdown and Generate JSON">
</a>
</td>
</tr>
</table>

<div style="float:left;">
<img src="https://geps.dev/progress/100?successColor=006600" alt="" />
Expand Down
17 changes: 17 additions & 0 deletions scripts/show_file_content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# show_file_content.sh

show_file_content() {
local file_path=$1
local display_file_contents=$2

if [[ -f "$file_path" ]]; then
if [[ "$display_file_contents" == 'true' ]]; then
echo "Displaying content of the file:"
cat "$file_path"
else
echo "Displaying content is blocked."
fi
else
echo "File does not exist."
fi
}

0 comments on commit 6a016ac

Please sign in to comment.