-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (76 loc) · 3.1 KB
/
cl-create.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
87
88
89
90
name: Changelog
on:
workflow_run:
workflows: ["ci"]
types:
- completed
branches:
- 'refs/tags/*'
jobs:
changelog:
name: Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Authenticate with private NPM package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
- name: Install changelog
run: npm i @flatfile/changelog --save-optional
- name: Set variables from cl-config.yml
run: |
destinationRepo=$(yq e '.destinationRepo' cl-config.yml)
destinationDirectory=$(yq e '.destinationDirectory' cl-config.yml)
echo "DESTINATION_REPO=${destinationRepo}" >> $GITHUB_ENV
echo "DESTINATION_DIRECTORY=${destinationDirectory}" >> $GITHUB_ENV
- name: Print all git tags
run: npm view @flatfile/api versions --json
- name: Get latest tag
run: |
git fetch --tags
TAG="$(git describe --tags --abbrev=0)"
echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
- name: Get Changelog token
id: changelog_token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ secrets.CHANGELOG_APP_ID }}
application_private_key: ${{ secrets.CHANGELOG_APP_KEY }}
- name: Create a changelog update
run: npx changelog generate tag ${{ env.RELEASE_TAG }}
env:
CLAUDE_API_KEY: ${{ secrets.CLAUDE_API_KEY }}
- name: Get changelog update file name
run: |
FILE_NAME=$(ls temp)
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
- name: Create branch in guides repo with changelog update
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ steps.changelog_token.outputs.token }}
with:
source_file: temp/${{ env.FILE_NAME}}
destination_repo: ${{ env.DESTINATION_REPO }}
destination_folder: changelog/src/${{ env.DESTINATION_DIRECTORY }}
destination_branch_create: changelog/${{ env.RELEASE_TAG }}
user_email: ${{ github.actor }}
user_name: github-actions[bot]
commit_message: "Updating the changelog for ${{ env.RELEASE_TAG }}"
- name: Create pull request
run: |
gh pr create \
--repo ${{ env.DESTINATION_REPO }} \
--base main \
--head changelog/${{ env.RELEASE_TAG }} \
--title "Changelog update changelog/${{ env.RELEASE_TAG }}" \
--reviewer ${{ secrets.REVIEWER }} \
--body "@coderabbitai: ignore
This pull request has been automatically created to update the changelog.
Edit the YYMMDD.mdx file with any updates.
Committing your changes will trigger the update changelog workflow, which will pull your updates into the main changelog files."
env:
GH_TOKEN: ${{ steps.changelog_token.outputs.token }}