Skip to content

Update dependency freelensapp/freelens to v1.6.1 (#29) #173

Update dependency freelensapp/freelens to v1.6.1 (#29)

Update dependency freelensapp/freelens to v1.6.1 (#29) #173

name: Automated WinGet update
on:
issue_comment:
types:
- created
push:
branches:
- updates
paths:
- .github/workflows/winget-update.yaml
- .versions.yaml
- make.sh
- template/**
workflow_dispatch: {}
permissions:
contents: write
pull-requests: write
jobs:
winget-update:
name: WinGet update
runs-on: ubuntu-24.04
environment: automated
if: github.event_name != 'issue_comment' || contains(github.event.comment.body, '/rerun')
steps:
- name: Checkout master branch
uses: actions/checkout@v5
with:
token: ${{ secrets.GH_TOKEN }}
ref: master
- name: Reset master branch
run: |
git remote add upstream https://github.com/microsoft/winget-pkgs.git
git fetch upstream
git reset --hard upstream/master
- name: Checkout updates branch
uses: actions/checkout@v5
with:
token: ${{ secrets.GH_TOKEN }}
ref: updates
path: updates.tmp
- name: Install mise
uses: jdx/mise-action@v3
with:
working_directory: updates.tmp
- name: Set version
run: |
echo "version=$(yq -r '.freelens' updates.tmp/.versions.yaml)" >> $GITHUB_ENV
- name: Check if version already exists
run: |
if [[ -d manifests/f/Freelensapp/Freelens/${version} ]]; then
echo "pr_type=Update" >> $GITHUB_ENV
else
echo "pr_type=New version" >> $GITHUB_ENV
fi
echo "version=$(yq -r '.freelens' updates.tmp/.versions.yaml)" >> $GITHUB_ENV
- name: Generate new manifests
run: |
mkdir -p manifests/f/Freelensapp/Freelens/${version}
cd updates.tmp
ln -s ../manifests manifests
bash -x make.sh
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Check for changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_ENV
else
echo "changes=false" >> $GITHUB_ENV
fi
- name: Commit and push to branch
if: env.changes == 'true'
uses: EndBug/add-and-commit@v9
with:
github_token: ${{ secrets.GH_TOKEN }}
default_author: github_actions
message: "${{ env.pr_type }}: Freelensapp.Freelens version ${{ env.version }}"
new_branch: Freelensapp-Freelens-${{ env.version }}
fetch: false
push: origin Freelensapp-Freelens-${{ env.version }} --set-upstream --force
- name: Create pull request
if: env.changes == 'true'
run: |-
if [[ $(gh pr view \
--repo microsoft/winget-pkgs \
--json state \
--jq .state \
freelensapp:Freelensapp-Freelens-${{ env.version }} || true) != "OPEN" ]];
then
gh pr create \
--repo microsoft/winget-pkgs \
--base master \
--head freelensapp:Freelensapp-Freelens-${{ env.version }} \
--title "${{ env.pr_type }}: Freelensapp.Freelens version ${{ env.version }}" \
--body "This PR updates the WinGet manifest for Freelensapp.Freelens version ${{ env.version }}."
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}