mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
add weekly-ci action
Signed-off-by: Evgeny Fedin <efedin@redhat.com>
This commit is contained in:
parent
0884e24849
commit
120018ee52
1 changed files with 67 additions and 0 deletions
67
.github/workflows/weekly_ci.yml
vendored
Normal file
67
.github/workflows/weekly_ci.yml
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# yamllint disable rule:line-length
|
||||
name: Weekly CI trigger
|
||||
on: # yamllint disable-line rule:truthy
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 13 * * 6'
|
||||
env:
|
||||
BRANCH_NAME: "weekly-ci"
|
||||
COMMIT_MESSAGE: "Weekly CI check"
|
||||
COMMENT: "[citest]"
|
||||
jobs:
|
||||
weekly_ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Delete the previous branch if exists
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const response = await github.rest.git.listMatchingRefs({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
branch: "heads/${{ env.BRANCH_NAME }}",
|
||||
});
|
||||
for (ref in response.data){
|
||||
if (response.data[ref].ref == "refs/heads/${{ env.BRANCH_NAME }}"){
|
||||
console.log("deleting branch");
|
||||
console.log(response.data[ref]);
|
||||
await github.rest.git.deleteRef({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref: "heads/${{ env.BRANCH_NAME }}",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Create and push empty commit
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git checkout -b weekly-ci
|
||||
git commit --allow-empty -m "${{ env.COMMIT_MESSAGE }}"
|
||||
git push --set-upstream origin ${{ env.BRANCH_NAME }}
|
||||
|
||||
- name: Create and comment pull request
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GH_PUSH_TOKEN }}
|
||||
script: |
|
||||
const response = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "${{ env.COMMIT_MESSAGE }}",
|
||||
head: "${{ env.BRANCH_NAME }}",
|
||||
base: context.ref
|
||||
});
|
||||
github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: response.data.number,
|
||||
body: "${{ env.COMMENT }}",
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue