diff --git a/.github/workflows/label-new-issues.yml b/.github/workflows/label-new-issues.yml index 286df11..32ae73b 100644 --- a/.github/workflows/label-new-issues.yml +++ b/.github/workflows/label-new-issues.yml @@ -44,16 +44,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - + - name: Create Branch id: create-branch run: | echo "We will create a branch with this name: $BRANCH_NAME" - git checkout -b $BRANCH_NAME - git push origin $BRANCH_NAME - echo "::set-output name=BRANCH_FULL_NAME::$BRANCH_NAME" - echo "::set-output name=BRANCH_SHA::$(git rev-parse HEAD)" + gh issue develop $ISSUE_NUMBER -b dev -n $BRANCH_NAME env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} BRANCH_NAME: ${{ steps.set-branch-name.outputs.BRANCH_FULL_NAME }} + ISSUE_NUMBER: ${{ github.event.issue.number }} diff --git a/.github/workflows/label-pr-as-issue.yml b/.github/workflows/label-pr-as-issue.yml new file mode 100644 index 0000000..c0cefd4 --- /dev/null +++ b/.github/workflows/label-pr-as-issue.yml @@ -0,0 +1,13 @@ +on: + pull_request: + types: [opened] + +jobs: + copy-labels: + runs-on: ubuntu-latest + name: Copy labels from linked issues + steps: + - name: copy-labels + uses: michalvankodev/copy-issue-labels@v1.3.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr-on-branch-push.yml b/.github/workflows/pr-on-branch-push.yml new file mode 100644 index 0000000..679fac0 --- /dev/null +++ b/.github/workflows/pr-on-branch-push.yml @@ -0,0 +1,38 @@ +name: Pull Request on Push to branch +on: + push: + branches-ignore: + - main + - dev + +jobs: + create-pull-request: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: dev + + - name: Create PR + run: | + echo "Get the list of PR for that branch that are open" + gh pr list -H ${{ github.ref_name}} -s "open" + PR_COUNT=$(gh pr list -H ${{ github.ref_name}} -s "open" | wc -l) + echo $PR_COUNT + echo "Checking if there are any PR already" + if [[ $PR_COUNT -gt 0 ]]; then + echo "Indeed there is at least one PR for this branch" + else + echo "There is no PR for this branch so we create one" + gh pr create -B $BASE_BRANCH -H $BRANCH_TO_MERGE --title "$PR_TITLE" --body "$PR_BODY" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_TITLE: "Autocreated PR: ${{ github.ref_name}}" + PR_BODY: "Created by Github action" + BASE_BRANCH: "dev" + BRANCH_TO_MERGE: ${{ github.ref}} + + diff --git a/test-folder/.random b/test-folder/.random index 8b13789..d755074 100644 --- a/test-folder/.random +++ b/test-folder/.random @@ -1 +1,2 @@ +# lwneflenflkew