-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Request a dispatched build for periodical jobs (#17657)
* Request a dispatched build for periodical jobs Automatically created PRs do not trigger other workflows by default. Request a dispatched PR build manually to overcome this. Also change the cron schedule to run these jobs only on workdays. * Fix if condition * fix dispatch * Fix variable * add token * sync gh dispatch code and update create-pull-request deps
- Loading branch information
Showing
3 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Fix linter hints | |
|
||
on: | ||
schedule: | ||
- cron: '0 */8 * * *' | ||
- cron: '0 */8 * * MON-FRI' | ||
|
||
workflow_dispatch: | ||
|
||
|
@@ -46,7 +46,8 @@ jobs: | |
run: | | ||
/bin/sh ../.github/scripts/web-code-quality.sh | curl -X POST -H 'Content-Type: application/json' -d @- ${{ secrets.DEV_METRICS_URL }} | ||
- name: Create/Update Pull Request | ||
uses: Graylog2/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad | ||
id: pr-create | ||
uses: Graylog2/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 | ||
with: | ||
title: Fixing linter hints automatically | ||
body: This PR was created by a job that is running periodically to find and fix linter hints. | ||
|
@@ -55,3 +56,26 @@ jobs: | |
committer: Dr. Lint-a-lot <[email protected]> | ||
commit-message: Running lint --fix | ||
delete-branch: true | ||
|
||
- name: Get headRef and SHA of PR | ||
id: pr-infos | ||
if: ${{ steps.pr-create.outputs.pull-request-operation != 'closed' }} | ||
run: | | ||
HEADREF=$(gh pr view ${{ steps.pr-create.outputs.pull-request-number }} --json headRefName --template '{{.headRefName}}') | ||
echo "sha=$(git rev-parse origin/$HEADREF)" >> $GITHUB_OUTPUT | ||
echo "headref=$HEADREF" >> $GITHUB_OUTPUT | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: Request dispatched PR build | ||
if: ${{ steps.pr-create.outputs.pull-request-operation != 'closed' }} | ||
run: > | ||
gh workflow run -R Graylog2/graylog-project-internal pr-build.yml --ref master | ||
-f caller_repo=${{ github.repository }} | ||
-f caller_pr_nr=${{ steps.pr-create.outputs.pull-request-number }} | ||
-f caller_base_branch=master | ||
-f caller_head_branch=${{ steps.pr-infos.outputs.headref }} | ||
-f head_sha=${{ steps.pr-infos.outputs.sha }} | ||
-f initial_actor="Dr. Lint-a-lot" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_GRAYLOG_PROJECT_INTERNAL_WORKFLOW_RW }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Update browserslist DB. | |
|
||
on: | ||
schedule: | ||
- cron: '0 0 1/14 * *' | ||
- cron: '0 0 1/14 * MON-FRI' | ||
|
||
workflow_dispatch: | ||
|
||
|
@@ -21,7 +21,8 @@ jobs: | |
continue-on-error: true | ||
run: npx browserslist@latest --update-db | ||
- name: Create/Update Pull Request | ||
uses: Graylog2/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad | ||
id: pr-create | ||
uses: Graylog2/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 | ||
with: | ||
title: Updating browserslist DB. | ||
body: This PR was created by a job that is running periodically to update the browserslist db automatically. See [here](https://github.com/browserslist/browserslist#browsers-data-updating) for details. | ||
|
@@ -30,3 +31,26 @@ jobs: | |
committer: Dr. Lint-a-lot <[email protected]> | ||
commit-message: Updating browserslist DB. | ||
delete-branch: true | ||
|
||
- name: Get headRef and SHA of PR | ||
id: pr-infos | ||
if: ${{ steps.pr-create.outputs.pull-request-operation != 'closed' }} | ||
run: | | ||
HEADREF=$(gh pr view ${{ steps.pr-create.outputs.pull-request-number }} --json headRefName --template '{{.headRefName}}') | ||
echo "sha=$(git rev-parse origin/$HEADREF)" >> $GITHUB_OUTPUT | ||
echo "headref=$HEADREF" >> $GITHUB_OUTPUT | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: Request dispatched PR build | ||
if: ${{ steps.pr-create.outputs.pull-request-operation != 'closed' }} | ||
run: > | ||
gh workflow run -R Graylog2/graylog-project-internal pr-build.yml --ref master | ||
-f caller_repo=${{ github.repository }} | ||
-f caller_pr_nr=${{ steps.pr-create.outputs.pull-request-number }} | ||
-f caller_base_branch=master | ||
-f caller_head_branch=${{ steps.pr-infos.outputs.headref }} | ||
-f head_sha=${{ steps.pr-infos.outputs.sha }} | ||
-f initial_actor="Dr. Lint-a-lot" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_GRAYLOG_PROJECT_INTERNAL_WORKFLOW_RW }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Updating yarn lockfile | |
|
||
on: | ||
schedule: | ||
- cron: '0 */12 * * *' | ||
- cron: '0 */12 * * MON-FRI' | ||
|
||
workflow_dispatch: | ||
|
||
|
@@ -18,7 +18,8 @@ jobs: | |
- name: Install dependencies | ||
run: yarn install | ||
- name: Create/Update Pull Request | ||
uses: Graylog2/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad | ||
id: pr-create | ||
uses: Graylog2/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 | ||
with: | ||
title: Updating yarn lockfile | ||
body: This PR was created by a job that is running periodically to update the yarn lockfile after transitive dependencies have been updated. | ||
|
@@ -27,3 +28,26 @@ jobs: | |
committer: Gary Bot <[email protected]> | ||
commit-message: Updating yarn lockfile | ||
delete-branch: true | ||
|
||
- name: Get headRef and SHA of PR | ||
id: pr-infos | ||
if: ${{ steps.pr-create.outputs.pull-request-operation != 'closed' }} | ||
run: | | ||
HEADREF=$(gh pr view ${{ steps.pr-create.outputs.pull-request-number }} --json headRefName --template '{{.headRefName}}') | ||
echo "sha=$(git rev-parse origin/$HEADREF)" >> $GITHUB_OUTPUT | ||
echo "headref=$HEADREF" >> $GITHUB_OUTPUT | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: Request dispatched PR build | ||
if: ${{ steps.pr-create.outputs.pull-request-operation != 'closed' }} | ||
run: > | ||
gh workflow run -R Graylog2/graylog-project-internal pr-build.yml --ref master | ||
-f caller_repo=${{ github.repository }} | ||
-f caller_pr_nr=${{ steps.pr-create.outputs.pull-request-number }} | ||
-f caller_base_branch=master | ||
-f caller_head_branch=${{ steps.pr-infos.outputs.headref }} | ||
-f head_sha=${{ steps.pr-infos.outputs.sha }} | ||
-f initial_actor="Dr. Lint-a-lot" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT_GRAYLOG_PROJECT_INTERNAL_WORKFLOW_RW }} |