Skip to content

Commit

Permalink
Merge pull request #9282 from camptocamp/c2cciutils-upgrade-2.7
Browse files Browse the repository at this point in the history
CI updates
  • Loading branch information
sbrunner authored Jan 31, 2024
2 parents 498148f + c40dd3c commit fb901ad
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 28 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/dependency-auto-review.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
types:
- opened
- reopened
- labeled
- unlabeled
- edited
- synchronize

Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/pull-request-automation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Auto reviews, merge and close pull requests

on:
pull_request:
types:
- opened
- reopened
- closed
pull_request_target:
types:
- closed

jobs:
auto-merge:
name: Auto reviews, merge and close pull requests
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
- name: Print event
run: echo "${GITHUB}" | jq
env:
GITHUB: ${{ toJson(github) }}
- name: Print context
uses: actions/github-script@v7
with:
script: |-
console.log(context);
- name: Auto reviews Renovate updates
uses: actions/github-script@v7
with:
script: |-
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
})
if: |-
github.event.pull_request.user.login == 'renovate[bot]'
&& (github.event.action == 'opened'
|| github.event.action == 'reopened')
- name: Auto review and merge snyk auto fix
uses: actions/github-script@v7
with:
script: |-
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
});
github.graphql(`
mutation {
enablePullRequestAutoMerge(input: {
pullRequestId: "${context.payload.pull_request.node_id}",
mergeMethod: SQUASH,
}) {
pullRequest {
autoMergeRequest {
enabledAt
}
}
}
}
`)
if: |-
github.event.pull_request.user.login == 'c2c-bot-gis-ci'
&& startsWith(github.head_ref, 'snyk-fix/')
&& (github.event.action == 'opened'
|| github.event.action == 'reopened')
- name: Restart audit workflow
uses: actions/github-script@v7
with:
script: |-
let runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'audit.yaml',
per_page: 1,
});
runs = runs.data.workflow_runs;
if (runs.length == 1 && runs[0].status != 'success') {
console.log(`Rerun workflow ${runs[0].id} ${runs[0].status}`);
github.rest.actions.reRunWorkflowFailedJobs({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: runs[0].id,
});
}
if: |-
github.event.pull_request.user.login == 'c2c-bot-gis-ci'
&& (startsWith(github.head_ref, 'snyk-fix/')
|| startsWith(github.head_ref, 'dpkg-update/'))
&& github.event.action == 'closed'
&& github.event.pull_request.merged == true
- name: Auto close pre-commit.ci autoupdate
uses: actions/github-script@v7
with:
script: |-
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed',
});
if: |-
github.event.pull_request.user.login == 'pre-commit-ci'
&& (github.event.action == 'opened'
|| github.event.action == 'reopened')
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ repos:
rev: v2.1.0
hooks:
- id: codespell
exclude: (^contribs/gmf/test/spec/data/themescapabilities\.js$|^contribs/gmf/test/spec/data/themes\.js$|^buildtools/asitvd.capabilities\.xml$|^examples/measure\.js$|^src/bootstrap-custom\.css\.map$)
exclude: |-
(?x)^(
contribs/gmf/test/spec/data/themescapabilities\.js
|contribs/gmf/test/spec/data/themes\.js
|buildtools/asitvd.capabilities\.xml
|examples/measure\.js
|src/bootstrap-custom\.css\.map
|\.github/workflows/pull-request-automation\.yaml
)$
args:
- --ignore-words=spell-ignore-words.txt

0 comments on commit fb901ad

Please sign in to comment.