Skip to content

Update Microdata Tools Version #389

Update Microdata Tools Version

Update Microdata Tools Version #389

name: Update Microdata Tools Version
on:
schedule:
- cron: 0 10 * * * # Runs everyday at 10:00
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
update-dependency:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure the full history is fetched
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check for New Version
id: check_version
run: |
CURRENT_VERSION=$(poetry show microdata-tools | grep version | awk '{print $3}')
LATEST_VERSION=$(curl -s https://pypi.org/pypi/microdata-tools/json | jq -r .info.version)
echo "Current version: $CURRENT_VERSION"
echo "Latest version: $LATEST_VERSION"
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "::set-output name=new_version::$LATEST_VERSION"
else
echo "Already up-to-date"
exit 0
fi
- name: Update Microdata Tools Dependency
if: steps.check_version.outputs.new_version
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git pull origin main
git checkout -b bump-microdata-tools-${{ steps.check_version.outputs.new_version }}
poetry add microdata-tools@${{ steps.check_version.outputs.new_version }}
git add pyproject.toml poetry.lock
git commit -m "Update microdata-tools to ${{ steps.check_version.outputs.new_version }}"
git push origin bump-microdata-tools-${{ steps.check_version.outputs.new_version }}
- name: Create Pull Request
if: steps.check_version.outputs.new_version
run: |
gh pr create \
--base main \
--head bump-microdata-tools-${{ steps.check_version.outputs.new_version }} \
--title "Update microdata-tools to ${{ steps.check_version.outputs.new_version }}" \
--body "This PR updates microdata-tools to version ${{ steps.check_version.outputs.new_version }}."
# --reviewer statisticsnorway/microdata-developers # Reviwer not found [should work according to docs](https://cli.github.com/manual/gh_pr_create)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}