-
-
Notifications
You must be signed in to change notification settings - Fork 7
86 lines (74 loc) · 3.19 KB
/
update-phpcs-versionnr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Update PHPCS version
on:
# Run every day at 3:40.
schedule:
- cron: '40 3 * * *'
# And whenever this workflow is updated.
pull_request:
paths:
- '.github/workflows/update-phpcs-versionnr.yml'
# Also allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
phpcs-version-check:
name: "Check latest PHPCS version"
# Don't run the cron job on forks.
if: ${{ github.event_name != 'schedule' || github.repository == 'PHPCSStandards/PHPCSUtils' }}
runs-on: ubuntu-latest
steps:
- name: Retrieve latest PHPCS release info
uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Debug info: Show API request failure status"
if: ${{ failure() }}
run: "echo No release found. Request failed with status ${{ steps.get_latest_release.outputs.status }}"
- name: Grab latest tag name from API response
id: version
run: |
echo "TAG=${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}" >> $GITHUB_OUTPUT
- name: Show tag name found in API response
run: "echo latest release: ${{ steps.version.outputs.TAG }}"
- name: Set branches to use
id: branches
run: |
echo "BASE=develop" >> $GITHUB_OUTPUT
echo "PR_BRANCH=feature/getversiontest-update-phpcs-version" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.branches.outputs.BASE }}
- name: Update the version constant in the test file
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "const DEVMASTER = '[^']+';"
replace: "const DEVMASTER = '${{ steps.version.outputs.TAG }}';"
include: "Tests/BackCompat/Helper/GetVersionTest.php"
regex: true
- name: "Debug info: Show git status"
run: git status -vv --untracked=all
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
base: ${{ steps.branches.outputs.BASE }}
branch: ${{ steps.branches.outputs.PR_BRANCH }}
delete-branch: true
sign-commits: true
commit-message: "GetVersionTest: update for release of PHPCS ${{ steps.version.outputs.TAG }}"
title: "GetVersionTest: update for release of PHPCS ${{ steps.version.outputs.TAG }}"
# yamllint disable rule:line-length
body: |
This PR is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) using the [`update-phpcs-versionnr.yml` workflow](https://github.com/PHPCSStandards/PHPCSUtils/blob/develop/.github/workflows/update-phpcs-versionnr.yml).
# yamllint enable rule:line-length
labels: |
Type: chores/QA
reviewers: |
jrfnl