diff --git a/.github/pr-branch-labeler.yml b/.github/pr-branch-labeler.yml new file mode 100644 index 0000000..a05e882 --- /dev/null +++ b/.github/pr-branch-labeler.yml @@ -0,0 +1,12 @@ +# Apply label "staging" +staging: + base: "staging" + +# Apply label "dev" +dev: + base: "development" + +# Apply whatever comes after release/ as the label +# E.g. Merging into 'release/1.0' will add the label '1.0' +$1: + baseRegExp: "release[/](.*)" diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 0000000..cb9ee3a --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,14 @@ +name: PR Branch Labeler + +on: + pull_request: + types: [opened] + +jobs: + label_prs: + runs-on: ubuntu-latest + steps: + - name: Label PRs + uses: TheCleric/pr-branch-labeler@v3 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pr-sync-approval.yml b/.github/workflows/pr-sync-approval.yml new file mode 100644 index 0000000..94b8cee --- /dev/null +++ b/.github/workflows/pr-sync-approval.yml @@ -0,0 +1,14 @@ +name: Auto approval for sync PRs without conflicts +on: + pull_request: + types: [opened] +jobs: + approve_syncs: + runs-on: ubuntu-latest + steps: + - name: Approve sync PRs + uses: nrccua/pr-approver@v1.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + label-list: sync + label-exclusion-list: conflicts,had conflicts,merge issues diff --git a/.github/workflows/pr-testing.yml b/.github/workflows/pr-testing.yml new file mode 100644 index 0000000..d18f0db --- /dev/null +++ b/.github/workflows/pr-testing.yml @@ -0,0 +1,47 @@ +name: Node Test for PRs + +on: + pull_request: + branches: + - development + - staging + - "release/*" + - main + +jobs: + test: + name: Install dependencies, test, and deploy a PR build + runs-on: ubuntu-latest + env: + aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET }}-pr-${{ github.event.number }} + strategy: + matrix: + node: ["14"] + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: | + ~/.npm + **/node_modules + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - run: npm i + - run: npm run test + - name: Build + run: npm run build + - uses: romeovs/lcov-reporter-action@v0.2.16 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + lcov-file: ./build/reports/jest/lcov.info