Skip to content

Commit

Permalink
Use if always(), and skip PRs with a milestone
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Nov 16, 2023
1 parent 1ac2dfa commit d82ff04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/dev_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
persist-credentials: false

- name: Check title for Conventional Commits format
continue-on-error: true
if: |
github.event_name == 'pull_request_target' &&
(github.event.action == 'opened' ||
Expand All @@ -51,7 +50,7 @@ jobs:
await script({github, context});
- name: Assign milestone
continue-on-error: true
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/dev_pr/milestone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ main() {
local -r pr_number="${2}"
echo "On ${repo} pull ${pr_number}"

local -r existing_milestone=$(gh pr view "${pr_number}" \
--json milestone \
-t '{{if .milestone}}{{.milestone.title}}{{else}}{{end}}')

if [[ ! -z "${existing_milestone}" ]]; then
echo "PR has milestone: ${existing_milestone}"
return 0
fi

local -r latest_version=$(git ls-remote --heads origin |
grep -o '[0-9.]*$' |
sort --version-sort |
tail -n1)

local -r milestone=$(gh api "/repos/${repo}/milestones" |
jq -r '.[] | .title' |
grep -E '^ADBC Libraries' |
Expand Down

0 comments on commit d82ff04

Please sign in to comment.