-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
86 lines (78 loc) · 3 KB
/
action.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: "Clifus"
description: "Run Clifus, create a pull request and report"
author: "Mergify"
inputs:
NAME:
required: true
description: "The Clifus source fancy name"
SOURCE:
required: true
description: "The Clifus source"
AUTHOR:
required: false
description: "The Clifus pull request author"
default: "mergify-ci-bot <mergify-ci-bot@users.noreply.github.com>"
GITHUB_TOKEN:
required: true
description: "GitHub Token"
SLACK_WEBHOOK_URL:
required: true
description: "Slack notification"
CLIFUS_CONFIGURATION:
required: false
description: Clifus configuration file
default: ".github/clifus.yml"
LABELS:
required: false
description: Clifus pull request labels
PUSH_TO_FORK:
required: false
description: Repository to push the pull request to
runs:
using: "composite"
steps:
- name: Setup python and run Clifus
id: clifus
shell: bash
env:
TMPDIR: ${{ runner.temp }}
run: |
python3 -m venv $TMPDIR/.venv
source $TMPDIR/.venv/bin/activate
python3 -m pip install -r ${{ github.action_path }}/requirements.txt
python ${{ github.action_path }}/clifus.py -c "${{ inputs.CLIFUS_CONFIGURATION }}" -s "${{ inputs.SOURCE }}" > output.txt
set -xv
cat output.txt
VERSION=$(cat output.txt | grep "Value of source '${{ inputs.SOURCE }}': " | awk -F ': ' '{print $2}')
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
rm output.txt
- name: Create the Pull Request
id: cpr
# yamllint disable-line rule:line-length
# nosemgrep: yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha
uses: peter-evans/create-pull-request@v6
with:
token: ${{ inputs.GITHUB_TOKEN }}
author: ${{ inputs.AUTHOR }}
push-to-fork: ${{ inputs.PUSH_TO_FORK }}
title: "chore: bump ${{ inputs.NAME }} version to ${{ steps.clifus.outputs.VERSION }}"
commit-message: "chore: bump ${{ inputs.NAME }} version to ${{ steps.clifus.outputs.VERSION }}"
# yamllint disable-line rule:line-length
body: This is an automated bump of ${{ inputs.NAME }} version to ${{ steps.clifus.outputs.VERSION }}
branch: clifus/${{ inputs.SOURCE }}-upgrade
base: main
labels: ${{ inputs.LABELS }}
- name: Check outputs
shell: bash
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Report Status
if: failure()
# yamllint disable-line rule:line-length
# nosemgrep: yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha
uses: Mergifyio/gha-slack-notification@main
with:
message: "Clifus: ${{ inputs.SOURCE }} version bump"
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
OVERRIDE_JOB_STATUS: failure