From 3d9bca5f12b86cbe603618be3ad5b74567ca153a Mon Sep 17 00:00:00 2001 From: fujr Date: Sat, 26 Apr 2025 19:19:11 +0800 Subject: [PATCH] github_action: fix crash on pr;and update policy to be triggered by all branch --- .github/workflows/main.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4cd5d48..33e18ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,8 +4,6 @@ on: push: tags: - 'v*' - branches: - - main paths-ignore: - "docs/**" - "README.md" @@ -32,6 +30,7 @@ jobs: branch_name: ${{ env.branch_name }} tag_name: ${{ env.tag_name }} push_type: ${{ env.push_type }} + is_pr: ${{ env.is_pr }} steps: - name: Determine push type @@ -45,6 +44,8 @@ jobs: echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV echo "push_type=branch" >> $GITHUB_ENV fi + is_pr=$([[ "${{ github.event_name }}" == "pull_request" ]] && echo 1 || echo 0) + echo "is_pr=${is_pr}" >> $GITHUB_ENV - name: Checkout 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 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 - if [[ ${is_diff} == 1 ]]; then + if [[ ${is_pr} == 0 ]] && [[ ${is_diff} == 1 ]]; then mv temp_support_list.md ./docs/support_list.md git config --global user.name "GitHub Action" git config --global user.email "github-action@users.noreply.github.com" @@ -172,6 +173,7 @@ jobs: name: Release Artifacts needs: [job_build_qmodem, job_prepare] runs-on: ubuntu-latest + if: ${{ needs.job_prepare.outputs.push_type == 'tag' }} steps: - name: Download all artifacts uses: actions/download-artifact@v4