github_action: fix crash on pr;and update policy to be triggered by all branch

This commit is contained in:
fujr 2025-04-26 19:19:11 +08:00
parent 7d49e14c13
commit 3d9bca5f12

View File

@ -4,8 +4,6 @@ on:
push: push:
tags: tags:
- 'v*' - 'v*'
branches:
- main
paths-ignore: paths-ignore:
- "docs/**" - "docs/**"
- "README.md" - "README.md"
@ -32,6 +30,7 @@ jobs:
branch_name: ${{ env.branch_name }} branch_name: ${{ env.branch_name }}
tag_name: ${{ env.tag_name }} tag_name: ${{ env.tag_name }}
push_type: ${{ env.push_type }} push_type: ${{ env.push_type }}
is_pr: ${{ env.is_pr }}
steps: steps:
- name: Determine push type - name: Determine push type
@ -45,6 +44,8 @@ jobs:
echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
echo "push_type=branch" >> $GITHUB_ENV echo "push_type=branch" >> $GITHUB_ENV
fi fi
is_pr=$([[ "${{ github.event_name }}" == "pull_request" ]] && echo 1 || echo 0)
echo "is_pr=${is_pr}" >> $GITHUB_ENV
- name: Checkout - name: Checkout
if: if:
@ -59,7 +60,7 @@ jobs:
python3 ./scripts/update_support_list.py temp_support_list ./luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json python3 ./scripts/update_support_list.py temp_support_list ./luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json
is_diff=$(diff ./temp_support_list.md ./docs/support_list.md > /dev/null 2>&1 && echo 0 || echo 1) is_diff=$(diff ./temp_support_list.md ./docs/support_list.md > /dev/null 2>&1 && echo 0 || echo 1)
echo "is_diff=${is_diff}" >> $GITHUB_ENV echo "is_diff=${is_diff}" >> $GITHUB_ENV
if [[ ${is_diff} == 1 ]]; then if [[ ${is_pr} == 0 ]] && [[ ${is_diff} == 1 ]]; then
mv temp_support_list.md ./docs/support_list.md mv temp_support_list.md ./docs/support_list.md
git config --global user.name "GitHub Action" git config --global user.name "GitHub Action"
git config --global user.email "github-action@users.noreply.github.com" git config --global user.email "github-action@users.noreply.github.com"
@ -172,6 +173,7 @@ jobs:
name: Release Artifacts name: Release Artifacts
needs: [job_build_qmodem, job_prepare] needs: [job_build_qmodem, job_prepare]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ needs.job_prepare.outputs.push_type == 'tag' }}
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4