Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI updates #838

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}
- name: Debug Snyk audit
run: ~/.venv/bin/c2cciutils-audit --branch=${{ matrix.branch }} || true
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}
DEBUG: '*snyk*'
if: failure()
- name: Check ci/dpkg-versions.yaml file existence
id: dpkg-versions
uses: andstor/file-existence-action@v2
with:
files: ci/dpkg-versions.yaml
- name: Update dpkg packages versions
run: ~/.venv/bin/c2cciutils-docker-versions-update --branch=${{ matrix.branch }}
if: steps.dpkg-versions.outputs.files_exists == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}
if: steps.dpkg-versions.outputs.files_exists == 'true'
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
if [[ ${{ github.ref_name }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
gh release create ${{ github.ref_name }} --generate-notes || true
fi
if: github.event_name == 'push' && github.ref_type == 'tag'
env:
GH_TOKEN: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}

if: github.event_name == 'push' && github.ref_type == 'tag'
- name: Get Date
id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/delete-old-workflow-run.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/delete-old-workflows-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ env:

jobs:
build:
name: Delete old workflow runs
runs-on: ubuntu-22.04
timeout-minutes: 25
name: Delete old workflow runs

steps:
- name: Delete old workflow runs
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
types:
- opened
- reopened
- closed
pull_request_target:
types:
- closed

jobs:
auto-merge:
Expand All @@ -13,7 +17,17 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/github-script@v7
- 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({
Expand All @@ -22,11 +36,12 @@ jobs:
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
})
name: Auto reviews Renovate updates
if: github.event.pull_request.user.login == 'renovate[bot]'
if: |-
github.event.pull_request.user.login == 'renovate[bot]'
&& (github.event.action == 'opened'
|| github.event.action == 'reopened')
- name: Auto review and merge dpkg updates
uses: actions/github-script@v7
if: github.event.pull_request.user.login == 'c2c-bot-gis-ci' && startsWith(github.head_ref, 'dpkg-update/')
with:
script: |-
github.rest.pulls.createReview({
Expand All @@ -49,9 +64,13 @@ jobs:
}
}
`)
if: |-
github.event.pull_request.user.login == 'c2c-bot-gis-ci'
&& startsWith(github.head_ref, 'dpkg-update/')
&& (github.event.action == 'opened'
|| github.event.action == 'reopened')
- name: Auto review and merge snyk auto fix
uses: actions/github-script@v7
if: github.event.pull_request.user.login == 'c2c-bot-gis-ci' && startsWith(github.head_ref, 'snyk-fix/')
with:
script: |-
github.rest.pulls.createReview({
Expand All @@ -74,9 +93,38 @@ jobs:
}
}
`)
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
if: github.event.pull_request.user.login == 'pre-commit-ci'
with:
script: |-
github.rest.pulls.update({
Expand All @@ -85,3 +133,7 @@ jobs:
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')