forked from nf-core/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (76 loc) · 3.09 KB
/
changelog.yml
File metadata and controls
89 lines (76 loc) · 3.09 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
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
name: Update CHANGELOG.md
on:
issue_comment:
types: [created] # Add "@nf-core-bot changelog" as a PR comment to trigger this workflow.
pull_request_target:
types: [opened]
branches:
- dev
jobs:
update_changelog:
runs-on: ubuntu-latest
steps:
- name: branch-deploy
id: branch-deploy
if: github.event_name == 'issue_comment'
uses: github/branch-deploy@c9fcc362bdcea69eecac6578dde245cd5e3a55bf # v10.4.3
with:
trigger: "@nf-core-bot changelog"
reaction: "eyes"
stable_branch: "dev"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
token: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
# Action runs on the issue comment, so we don't get the PR by default.
# Use the GitHub CLI to check out the PR:
- name: Checkout Pull Request
env:
GH_TOKEN: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
run: |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
PR_NUMBER="${{ github.event.issue.number }}"
elif [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
fi
gh pr checkout $PR_NUMBER
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
- name: Install packages
run: pip install pyyaml
- name: Update CHANGELOG.md from the PR title
env:
COMMENT: ${{ github.event.comment.body }}
GH_TOKEN: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
PR_TITLE: ${{ github.event.issue.title || github.event.pull_request.title }}
run: |
python ${GITHUB_WORKSPACE}/.github/workflows/changelog.py
- name: Check if CHANGELOG.md actually changed
id: file_changed
run: |
# Show the diff for debugging
git diff -- ${GITHUB_WORKSPACE}/CHANGELOG.md
# Check if file has unstaged changes
[ -n "$(git diff -- ${GITHUB_WORKSPACE}/CHANGELOG.md)" ] && file_changed="TRUE" || file_changed="FALSE"
echo "File changed: $file_changed"
echo "changed=$file_changed" >> $GITHUB_OUTPUT
- name: Set up Python 3.14
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
- name: Run pre-commit rules with prek
uses: j178/prek-action@0bb87d7f00b0c99306c8bcb8b8beba1eb581c037 # v1
with:
extra-args: --config .pre-commit-config.yaml --all-files
- name: Commit and push changes
if: steps.file_changed.outputs.changed == 'TRUE'
env:
GH_TOKEN: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
run: |
git config user.email "core@nf-co.re"
git config user.name "nf-core-bot"
git add ${GITHUB_WORKSPACE}/CHANGELOG.md
git status
git commit -m "[automated] Update CHANGELOG.md"
git push