-
-
Notifications
You must be signed in to change notification settings - Fork 80
77 lines (65 loc) · 2.82 KB
/
manual_new_rdp.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
name: "🗞 New GeoRDP"
on:
workflow_dispatch:
inputs:
date:
type: string
description: Date de la prochaine RDP au format YYYY-MM-DD
required: true
notify-slack:
type: boolean
default: true
description: Notifier l'équipe sur Slack
required: false
env:
LANG: "fr_FR.UTF-8"
LC_ALL: "fr_FR.UTF-8"
LC_TIME: "fr_FR.UTF-8"
jobs:
create_rdp:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'geotribu' }}
steps:
- name: Install French locale
id: locale-fr
shell: bash
run: |
sudo locale-gen fr_FR.UTF-8
sudo update-locale LANG=fr_FR.UTF-8
echo "DATE_FR_LONG=$(date -d ${{ github.event.inputs.date }} '+%-d %B %Y')" >> $GITHUB_ENV
- name: Get source code
uses: actions/checkout@v4
- name: Create a new GeoRDP
shell: bash
run: bash ./scripts/new_rdp.sh ${{ github.event.inputs.date }}
- name: New branch
run: |
git config user.name ${{ github.actor }}
git config user.email '${{ github.actor }}@users.noreply.github.com'
git checkout -b rdp/${{ github.event.inputs.date }}
git status
- name: Commit new GeoRDP
run: |
git add content/rdp/
git commit -am "Crée la GeoRDP ${{ github.event.inputs.date }}"
- name: Push to remote
run: git push origin rdp/${{ github.event.inputs.date }}
- name: Create Pull Request
id: cpr
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: rdp/${{ github.event.inputs.date }}
destination_branch: "master"
pr_allow_empty: false
pr_title: "🗞 GeoRDP du ${{ env.DATE_FR_LONG }}"
pr_template: .github/PULL_REQUEST_TEMPLATE.md
- name: Notification Slack
id: slack
uses: slackapi/[email protected]
if: "${{ github.event.inputs.notify-slack == 'true' }}"
with:
payload: '{"blocks":[{"type":"section","text":{"type":"mrkdwn","text":":newspaper: La GeoRDP du ${{ env.DATE_FR_LONG }} a été créée et attend vos contributions :writing_hand: !"}},{"type":"section","fields":[{"type":"mrkdwn","text":"Créée par *${{ github.actor }}* via GitHub Action."}]},{"type":"actions","elements":[{"type":"button","text":{"type":"plain_text","emoji":true,"text":":squid: Voir la PR (GitHub)"},"url":"${{ steps.cpr.outputs.pr_url }}"},{"type":"button","text":{"type":"plain_text","emoji":true,"text":":eye: Voir la preview (Netlify)"},"style":"primary","url":"https://preview-pullrequest-${{steps.cpr.outputs.pr_number}}--geotribu-preprod.netlify.app/"}]}]}'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK