Skip to content

Commit

Permalink
fix(update-please): Always make a new PR (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvedotrc authored Jul 2, 2024
1 parent 664d483 commit 9fc6f56
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions .github/actions/create-pull-request/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ runs:
shell: bash
run: |
[ -n "$ACTOR" ] && git config user.email "${ACTOR_ID}+${ACTOR}@users.noreply.github.com" || git config user.email [email protected]
[ -n "$ACTOR" ] && git config user.name $ACTOR || git config user.name hedia-bot
[ -n "$ACTOR" ] && git config user.name "$ACTOR" || git config user.name hedia-bot
env:
ACTOR_ID: ${{ github.actor_id }}
ACTOR: ${{ github.actor }}
Expand All @@ -55,7 +55,7 @@ runs:
name: Commit Changes
shell: bash
run: |
git checkout -b $HEAD
git checkout -b "$HEAD"
git add .
[ -n "$COMMIT" ] && git commit -m "$COMMIT" || git commit -m "$TITLE"
[ -n "$FORCE" ] && git push -f -u origin $HEAD || git push -u origin $HEAD
Expand All @@ -74,28 +74,17 @@ runs:
script: |
const { BASE, BODY, DEFAULT_BRANCH, DRAFT, HEAD, OWNER, REPO, TITLE } = process.env;
const { data: pullRequests } = await github.rest.pulls.list({
owner: OWNER,
repo: REPO,
base: BASE ?? DEFAULT_BRANCH,
head: HEAD
const { data: pullRequest } = await github.rest.pulls.create({
owner: OWNER,
repo: REPO,
base: BASE ?? DEFAULT_BRANCH,
head: HEAD,
title: TITLE,
body: BODY ?? null,
draft: DRAFT ? true : false
});
const hasOpenedPR = pullRequests.reduce((hasOpenedPR, pullRequest) => hasOpenedPR || pullRequest.state === "open", false);
if (!hasOpenedPR) {
const { data: pullRequest } = await github.rest.pulls.create({
owner: OWNER,
repo: REPO,
base: BASE ?? DEFAULT_BRANCH,
head: HEAD,
title: TITLE,
body: BODY ?? null,
draft: DRAFT ? true : false
});
console.log(`@${OWNER}/${REPO}#${pullRequest.number}: PR Created`);
}
console.log(`@${OWNER}/${REPO}#${pullRequest.number}: PR Created`);
env:
BASE: ${{ inputs.base }}
BODY: ${{ inputs.body }}
Expand All @@ -116,7 +105,7 @@ runs:
- if: steps.git-status.outputs.changes == 'true' && inputs.assignee
name: Add Assignee
shell: bash
run: gh pr edit --add-assignee $ASSIGNEE
run: gh pr edit --add-assignee "$ASSIGNEE"
env:
ASSIGNEE: ${{ inputs.assignee }}
GH_TOKEN: ${{ inputs.github-token }}

0 comments on commit 9fc6f56

Please sign in to comment.