Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment: Run autoupdate check on flatpak-pydeps.yml #9616

Closed
wants to merge 13 commits into from
54 changes: 54 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,57 @@ jobs:
path: |
RPMS/
SRPMS/

flatpak-pydeps:
name: "Update Flatpak Python Deps"
runs-on: ubuntu-latest
#if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'pull_request' }}
permissions:
contents: write

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Checkout flatpak-builder-tools
uses: actions/checkout@v4
with:
repository: flatpak/flatpak-builder-tools
path: 3rdparty/flatpak-builder-tools

- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- run: pip install requirements-parser

- name: Rebuild flatpak-pydeps.yaml
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check to see if the pydeps need updating.
git fetch origin "${{ github.base_ref }}" --depth=1
if git diff --name-only "origin/${{ github.base_ref }}" | grep -q '^linux/flatpak-pydeps.yaml'; then
# Skip this check if the pydeps were already updated in this PR.
echo "linux/flatpak-pydeps.yaml has already been updated"
exit 0
fi
if git diff --name-only "origin/${{ github.base_ref }}" | grep -q '^requirements.txt'; then
# Regenerate the pydeps.yml
FLATPAK_PIP_ARGS="-r requirements.txt --output linux/flatpak-pydeps --yaml --build-only"
3rdparty/flatpak-builder-tools/pip/flatpak-pip-generator $FLATPAK_PIP_ARGS

echo "Diffing..."
git diff

# Add the commit
git add linux/flatpak-pydeps.yaml
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git commit -m "[Bot] Update linux/flatpak-pydeps.yaml"
git push
fi
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1067,3 +1067,4 @@ yamllint==1.35.1 \
--hash=sha256:2e16e504bb129ff515b37823b472750b36b6de07963bd74b307341ef5ad8bdc3 \
--hash=sha256:7a003809f88324fd2c877734f2d575ee7881dd9043360657cc8049c809eba6cd
# via -r requirements.in

Loading