瀏覽代碼

Remove GitHub Action commands (#8123)

* https://github.com/FreshRSS/FreshRSS/pull/8098
* https://github.com/FreshRSS/FreshRSS/pull/8106
Alexandre Alapetite 5 月之前
父節點
當前提交
470e1a79b8
共有 1 個文件被更改,包括 0 次插入169 次删除
  1. 0 169
      .github/workflows/commands.yml

+ 0 - 169
.github/workflows/commands.yml

@@ -1,169 +0,0 @@
-name: Trigger actions on PR comments
-
-on:
-  issue_comment:
-    types: [created]
-
-permissions:
-  contents: write
-  pull-requests: write
-  issues: write
-
-jobs:
-  fix-all:
-    if: |
-      github.event.issue.pull_request != null &&
-      github.event.comment.body == '/fix-all' &&
-      (
-        github.event.comment.author_association == 'OWNER' ||
-        github.event.comment.author_association == 'MEMBER' ||
-        (github.event.comment.user != null && github.event.comment.user.login == github.event.issue.user.login)
-      )
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Post acknowledgment comment
-        uses: actions/github-script@v8
-        with:
-          script: |
-            await github.rest.issues.createComment({
-              owner: context.repo.owner,
-              repo: context.repo.repo,
-              issue_number: context.issue.number,
-              body: '🤖 Command `/fix-all` received. Running…'
-            });
-
-      - name: Get PR details
-        uses: actions/github-script@v8
-        id: pr
-        with:
-          script: |
-            const pr = await github.rest.pulls.get({
-              owner: context.repo.owner,
-              repo: context.repo.repo,
-              pull_number: context.issue.number
-            });
-
-            if (pr.data.state !== 'open') {
-              await github.rest.issues.createComment({
-                owner: context.repo.owner,
-                repo: context.repo.repo,
-                issue_number: context.issue.number,
-                body: '⚠️ Command `/fix-all` can only be run on open pull requests.'
-              });
-              core.setFailed('PR is not open');
-              return;
-            }
-
-            return pr.data.head;
-
-      - name: Checkout PR branch
-        uses: actions/checkout@v5
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          repository: ${{ fromJSON(steps.pr.outputs.result).repo.full_name }}
-          ref: ${{ fromJSON(steps.pr.outputs.result).ref }}
-
-      - name: Use Composer cache
-        id: composer-cache
-        uses: actions/cache@v4
-        with:
-          path: vendor
-          key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
-          restore-keys: |
-            ${{ runner.os }}-php-
-
-      - name: Run Composer install
-        run: composer install --prefer-dist --no-progress
-        if: steps.composer-cache.outputs.cache-hit != 'true'
-
-      - name: Uses Node.js
-        uses: actions/setup-node@v5
-        with:
-          node-version: lts/*
-          cache: npm
-
-      - run: npm ci
-
-      - name: Run make fix-all
-        id: fix
-        run: |
-          set -e
-          make fix-all || {
-            echo "make_failed=true" >> $GITHUB_OUTPUT
-            exit 1
-          }
-          echo "make_failed=false" >> $GITHUB_OUTPUT
-
-      - name: Commit and push changes
-        id: commit
-        if: success()
-        env:
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          HEAD_REPO: ${{ fromJSON(steps.pr.outputs.result).repo.full_name }}
-          HEAD_BRANCH: ${{ fromJSON(steps.pr.outputs.result).ref }}
-        run: |
-          git add -A
-          if git diff --cached --quiet; then
-            echo "no_changes=true" >> $GITHUB_OUTPUT
-            echo "No changes to commit."
-          else
-            echo "no_changes=false" >> $GITHUB_OUTPUT
-
-            git config user.name "github-actions[bot]"
-            git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
-
-            echo "Head repo: $HEAD_REPO"
-            echo "Head branch: $HEAD_BRANCH"
-
-            # Create commit
-            git commit -m "chore: make fix-all"
-            COMMIT_SHA=$(git rev-parse HEAD)
-            echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
-
-            # Try to push
-            if git push https://x-access-token:${GH_TOKEN}@github.com/${HEAD_REPO}.git HEAD:${HEAD_BRANCH}; then
-              echo "pushed=true" >> $GITHUB_OUTPUT
-              echo "Successfully pushed to $HEAD_REPO"
-            else
-              echo "pushed=false" >> $GITHUB_OUTPUT
-              echo "Failed to push!"
-              exit 1
-            fi
-          fi
-
-      - name: Post completion comment
-        uses: actions/github-script@v8
-        if: always()
-        with:
-          script: |
-            const makeFailed = '${{ steps.fix.outputs.make_failed }}' === 'true';
-            const noChanges = '${{ steps.commit.outputs.no_changes || 'false' }}' === 'true';
-            const pushed = '${{ steps.commit.outputs.pushed || 'false' }}' === 'true';
-            const commitSha = '${{ steps.commit.outputs.commit_sha }}';
-            const jobStatus = '${{ job.status }}';
-
-            let message;
-            if (jobStatus === 'success') {
-              if (noChanges) {
-                message = '✅ Command `/fix-all` completed with no change.';
-              } else if (pushed) {
-                message = `🔧 Command \`/fix-all\` made some fixes and committed as ${commitSha}`;
-              } else {
-                // Should not happen
-                message = 'ℹ️ Command `/fix-all` completed, but strangely.';
-              }
-            } else if (makeFailed) {
-              message = `❌ Command \`/fix-all\` failed. Check the [workflow run](${context.payload.repository.html_url}/actions/runs/${context.runId}) for details.`;
-            } else {
-              message = `⚠️ Command \`/fix-all\` ran successfully, but changes could not be pushed.\n\n`;
-              message += `* Please check that your PR settings “Allow edits from maintainers” is enabled.\n`;
-              message += `* Or run \`make fix-all\` locally and push to your branch.`;
-            }
-
-            await github.rest.issues.createComment({
-              owner: context.repo.owner,
-              repo: context.repo.repo,
-              issue_number: context.issue.number,
-              body: message
-            });