Skip to content

remove unneccessary function #66

remove unneccessary function

remove unneccessary function #66

Workflow file for this run

name: PIB_India
on:
push:
tags:
- 'PIB_India_*_*'
workflow_dispatch:
jobs:
pib_articles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setting_up
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
sudo apt update
sudo apt install --fix-missing -y python3 wkhtmltopdf fd-find poppler-utils
sudo ln -s $(which fdfind) /usr/bin/fd
sudo pip install -r requirements.txt
mkdir -p /home/runner/zips/{text,monthly,daily}
sudo pip install -U pyopenssl cryptography
- name: set env
run: |
echo ${{ github.ref_name }}
PIB_TAG=${{ github.ref_name }}
echo "PIB_MONTH=$(echo ${PIB_TAG} | egrep -o '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)')" >> $GITHUB_ENV
echo "PIB_YEAR=$(echo ${PIB_TAG} | egrep -o '202[0-9]')" >> $GITHUB_ENV
- name: download and unzip previous articles
run: |
source .env
mkdir -p /home/runner/pib/${{ env.PIB_YEAR }}
cd /home/runner
wget -q -c "https://github.com/nit-in/pib/releases/download/PIB_Monthly_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}/PIB_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip" || err_handle "11" "Error downloading PIB_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip"
unzip "PIB_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip" -d /home/runner/pib/${{ env.PIB_YEAR }} || err_handle "12" "Error unzipping PIB_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip"
- name: run script
run: |
source .env
pib_month ${{ env.PIB_MONTH }} ${{ env.PIB_YEAR }} || err_handle "10" "Spider failed to run"
- name: make txt files
run: |
source .env
pdftxt
- name: zipup_months_articles
run: |
source .env
cd /home/runner/pib/${{ env.PIB_YEAR }}
zip -r "/home/runner/zips/monthly/PIB_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip" ${{ env.PIB_MONTH }} || err_handle "13" "Failed to create PIB_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip"
- name: zipup_months_articles_by_days
run: |
source .env
cd /home/runner
for day in pib/${{ env.PIB_YEAR }}/${{ env.PIB_MONTH }}/*; do
echo $day
dayname=$(basename $day)
zip -r "/home/runner/zips/daily/PIB_${dayname}_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip" $day || err_handle "13" "Failed to create PIB_${dayname}_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip"
done
- name: zipup_text
run: |
source .env
cd /home/runner/pib_text/${{ env.PIB_YEAR }}
zip -r "/home/runner/zips/text/PIB_TEXT_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip" ${{ env.PIB_MONTH }} || err_handle "13" "PIB_TEXT_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}.zip"
- name: Create Monthly zip
uses: ncipollo/release-action@v1
with:
artifacts: "/home/runner/zips/monthly/*.zip"
token: ${{ secrets.PIB }}
tag: "PIB_Monthly_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}"
allowUpdates: true
body : "PIB articles for the month of ${{ env.PIB_MONTH }}, ${{ env.PIB_YEAR }}"
- name: Create Daily zips
uses: ncipollo/release-action@v1
with:
artifacts: "/home/runner/zips/daily/*.zip"
token: ${{ secrets.PIB }}
tag: "PIB_Daily_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}"
allowUpdates: true
body : "PIB articles (by date) for the month of ${{ env.PIB_MONTH }}, ${{ env.PIB_YEAR }}"
- name: Create text zips
uses: ncipollo/release-action@v1
with:
artifacts: "/home/runner/zips/text/*.zip"
token: ${{ secrets.PIB }}
tag: "PIB_Text_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}"
allowUpdates: true
body : "PIB articles text for the month of ${{ env.PIB_MONTH }}, ${{ env.PIB_YEAR }}"
- name: Create Link text files
uses: ncipollo/release-action@v1
with:
artifacts: "/home/runner/piblinks/*.txt"
token: ${{ secrets.PIB }}
tag: "PIB_Links_${{ env.PIB_MONTH }}_${{ env.PIB_YEAR }}"
allowUpdates: true
body : "PIB articles links for the month of ${{ env.PIB_MONTH }}, ${{ env.PIB_YEAR }}"