diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000..7b1b806 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,16 @@ +name: Lint GitHub Actions workflows +on: + pull_request: + branches: + - develop + - main + +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: actionlint + uses: raven-actions/actionlint@v1 + with: + flags: "-ignore SC2086 -ignore SC2116" diff --git a/.github/workflows/lint-pr-titles.yml b/.github/workflows/lint-pr-titles.yml new file mode 100644 index 0000000..a4ed90b --- /dev/null +++ b/.github/workflows/lint-pr-titles.yml @@ -0,0 +1,20 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + validate-pr-title: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/merge-develop-into-main.yml b/.github/workflows/merge-develop-into-main.yml index 56533ac..13e8ca0 100644 --- a/.github/workflows/merge-develop-into-main.yml +++ b/.github/workflows/merge-develop-into-main.yml @@ -19,13 +19,21 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: Configure Git + run: | + git config --global user.email "norepl@github.com" + git config --global user.name "GitHub Actions Bot" + - name: 'Create merge branch: develop --> main' run: | - git checkout release/merge-develop-into-main || git checkout -b release/merge-develop-into-main + git checkout -b release/merge-develop-into-main git rebase develop + git pull -r origin main git push --set-upstream origin release/merge-develop-into-main --force + - name: Create PR run: | - (gh pr --repo $GITHUB_REPOSITORY create --fill --title "chore(develop): Merge changes from develop into main" --base main) || exit 0 + (gh pr --repo $GITHUB_REPOSITORY create --fill --title "chore(develop): Merge changes from develop into main" --reviewer tinogo --base main) || exit 0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 56d4853..81bb7ba 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -25,11 +25,18 @@ jobs: with: fetch-depth: 0 + - name: Configure Git + if: ${{ steps.release.outputs.release_created }} + run: | + git config --global user.email "norepl@github.com" + git config --global user.name "GitHub Actions Bot" + - name: 'Create merge branch: main --> develop' if: ${{ steps.release.outputs.release_created }} run: | - git checkout release/merge-main-into-develop || git checkout -b release/merge-main-into-develop + git checkout -b release/merge-main-into-develop git rebase main + git pull -r origin develop git push --set-upstream origin release/merge-main-into-develop --force - name: Create PR @@ -42,8 +49,9 @@ jobs: - name: Enable auto-merge for the PR if: ${{ steps.release.outputs.release_created }} run: | - pull_request_url=$(gh pr view release/merge-main-into-develop --json url --jq '. | .url') - gh pr --repo $GITHUB_REPOSITORY merge $pull_request_url --auto --merge - gh pr --repo $GITHUB_REPOSITORY review $pull_request_url --approve + gh pr --repo $GITHUB_REPOSITORY review release/merge-main-into-develop --approve + gh pr --repo $GITHUB_REPOSITORY merge release/merge-main-into-develop --auto --merge env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # the approver of a PR can not be the same user as the creator of the PR. + # That's why we are sticking with the default runner user here + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}