diff --git a/.github/workflows/archive.yml b/.github/workflows/archive.yml index 12bb309..c2ee2c1 100644 --- a/.github/workflows/archive.yml +++ b/.github/workflows/archive.yml @@ -3,7 +3,7 @@ name: Archive EOL repositories on: schedule: - cron: '0 0 1 * *' - workflow_dispatch: {} + workflow_dispatch: jobs: archive: diff --git a/.github/workflows/close-master-prs.yml b/.github/workflows/close-master-prs.yml index b356c26..2a80ed1 100644 --- a/.github/workflows/close-master-prs.yml +++ b/.github/workflows/close-master-prs.yml @@ -1,11 +1,8 @@ name: Close PRs to master -# DO NOT RUN ANY CODE OR CHECKOUT OR USE ORG SECRETS HERE -# pull_request_target RUNS ON PUBLIC FORKS IN REPO'S CONTEXT - on: pull_request_target: - types: [opened, reopened, synchronize, edited] + types: [opened] branches: - master workflow_dispatch: @@ -19,14 +16,14 @@ jobs: steps: - name: Check and close run: | - has_label=$(gh pr --repo "$REPO" view "${{ github.event.pull_request.number }}" --json labels -q '.labels | any(.name == "leave-open")') + has_label=$(gh pr view "${{ github.event.pull_request.number }}" --json labels -q '.labels | any(.name == "leave-open")') if [[ "$has_label" != "true" ]]; then echo "leave-open label not found. Closing." gh pr --repo "$REPO" close "${{ github.event.pull_request.number }}" -c "$COMMENT" fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: flathub/flathub + GH_REPO: ${{ github.repository }} COMMENT: > This PR is automatically closed because application submission PRs must be made against the new-pr branch. If this is done diff --git a/.github/workflows/lock-prs.yml b/.github/workflows/lock-prs.yml index 72a90cf..0f189c1 100644 --- a/.github/workflows/lock-prs.yml +++ b/.github/workflows/lock-prs.yml @@ -4,7 +4,6 @@ on: schedule: - cron: "0 */6 * * *" workflow_dispatch: - workflow_call: jobs: lock: @@ -12,19 +11,19 @@ jobs: steps: - name: Lock closed PRs run: | - pr_list=$(gh pr list --repo "$REPO" -L 100000 --state closed --json number,updatedAt) + pr_list=$(gh pr list -L 100000 --state closed --json number,updatedAt) recent_prs=$(echo "$pr_list" | jq '[.[] | select(.updatedAt >= (now - (7 * 24 * 60 * 60) | todate))]') sorted_prs=$(echo "$recent_prs" | jq 'sort_by(.updatedAt) | .[] | {number: .number, updatedAt: .updatedAt}') cmd=$(echo "$sorted_prs" | jq '.number' | head -n 100) for num in $cmd; do - if [ "$(gh api repos/"$REPO"/issues/"$num" --jq '.locked')" = "false" ]; then - if ! gh pr view --repo "$REPO" --json labels -q '.labels[].name' "$num"|grep -qE "^(Stale|leave-open)$"; then + if [ "$(gh api repos/"$GH_REPO"/issues/"$num" --jq '.locked')" = "false" ]; then + if ! gh pr view --json labels -q '.labels[].name' "$num"|grep -qE "^(Stale|leave-open)$"; then echo "Locking pull request $num" - gh pr lock --repo "$REPO" --reason "resolved" "$num" + gh pr lock --reason "resolved" "$num" fi fi done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: flathub/flathub + GH_REPO: ${{ github.repository }}