Remove some redundant fields from various workflows

This commit is contained in:
bbhtt 2024-12-08 12:39:35 +05:30
parent 198f39da1b
commit 8ace2bb0e2
No known key found for this signature in database
GPG key ID: 0C3251A24745E484
3 changed files with 9 additions and 13 deletions

View file

@ -3,7 +3,7 @@ name: Archive EOL repositories
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch: {}
workflow_dispatch:
jobs:
archive:

View file

@ -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

View file

@ -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 }}