forked from mixxxdj/manual
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add workflow to update changelog and rebuild on repo dispatch
This workflow can be triggered using a personal access token (PAT) with the `public_repo` scope. $ curl -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <your-token>" \ --request POST \ --data '{"event_type": "update-changelog", "client_payload": {"branch": "2.3"}}' \ https://api.github.com/repos/mixxxdj/manual/dispatches It will then run `tools/update_changelog.py` and if any files were changed, it will commit these changes and then trigger rebuild of the manual. For the latter to work, a `MIXXXBOT_CHANGELOG_AUTOUPDATER_PAT` repository secret needs to be present, because the default `GITHUB_TOKEN` doesn't suffice.
- Loading branch information
Showing
4 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Changelog | ||
|
||
on: | ||
repository_dispatch: | ||
types: update-changelog | ||
|
||
jobs: | ||
update-changelog: | ||
name: Update Changelog | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Event Information | ||
run: echo "Event '${{ github.event.action }}' received from '${{ github.event.client_payload.repository }}'" | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.client_payload.branch }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install Python dependencies | ||
run: pip install -r requirements-changelog.txt | ||
- name: Update Changelog | ||
run: tools/update_changelog.py -b "${{ github.event.client_payload.branch }}" | ||
- name: Check if changes any changes were made | ||
run: echo "GIT_DIRTY=$(git diff --quiet ; printf "%d" "$?")" >> "${GITHUB_ENV}" | ||
- uses: EndBug/add-and-commit@v7 | ||
if: env.GIT_DIRTY != null && env.GIT_DIRTY != '0' | ||
with: | ||
branch: ${{ github.event.client_payload.branch }} | ||
add: "source/chapters/appendix/version_history.rst" | ||
message: "appendix/version_history: Update changelog for ${{ github.event.client_payload.branch }} branch" | ||
author_name: mixxxbot | ||
author_email: [email protected] | ||
push: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Trigger Rebuild | ||
uses: peter-evans/repository-dispatch@v1 | ||
if: env.GIT_DIRTY != null && env.GIT_DIRTY != '0' && env.MIXXXBOT_TOKEN != null | ||
with: | ||
token: ${{ env.MIXXXBOT_TOKEN }} | ||
event-type: rebuild | ||
env: | ||
MIXXXBOT_TOKEN: ${{ secrets.MIXXXBOT_CHANGELOG_AUTOUPDATER_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
m2r2 | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters