-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
56 lines (56 loc) · 2.11 KB
/
action.yml
File metadata and controls
56 lines (56 loc) · 2.11 KB
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
name: Ditto GitHub Action
description: Automatically updates Ditto text in a repository that has ditto-cli initiated
inputs:
ditto-api-key:
description: "Your Ditto API key. More info: https://developer.dittowords.com/api-reference#creating-an-api-key"
required: true
ditto-dir:
description: "`ditto` directory location. Only required if the `ditto` directory is not located at the root of your repository. Must include 'ditto' (e.g. './src/ditto')."
required: false
default: "./ditto"
pr-title-prefix:
description: "String to prefix the pull request title with."
required: false
default: "Ditto text update"
pull-from-legacy:
description: "By default, will pull from the latest version of Ditto. Set this to true to pull from legacy Ditto projects based on a legacy config file."
required: false
default: false
runs:
using: "composite"
steps:
- name: Set current date as env variable
id: datetime
run: echo "datetime=$(date +'%Y-%m-%dT-%H%M%S')" >> $GITHUB_OUTPUT
shell: bash
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install --global @dittowords/cli@^5.0.0
shell: bash
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Ditto pull
env:
DITTO_API_KEY: ${{ inputs.ditto-api-key }} # Legacy CLI
DITTO_TOKEN: ${{ inputs.ditto-api-key }} # CLI v5
shell: bash
run: |
cd ${{ inputs.ditto-dir }}/..
if [ "${{ inputs.pull-from-legacy }}" = "true" ]; then
npx ditto-cli pull --legacy -m githubActionRequest:true
else
npx ditto-cli pull -m githubActionRequest:true
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "ditto: text update ${{ steps.datetime.outputs.datetime }}"
title: ${{ inputs.pr-title-prefix }} ${{ steps.datetime.outputs.datetime }}
body: Automated change by the Ditto Text Updater action
branch: ditto-update-${{ steps.datetime.outputs.datetime }}
branding:
icon: type
color: yellow