Skip to content

Commit efb5f3e

Browse files
anweshadasoraNodwebknjazfelixfontein
authored
Initial (GHA) Workflow for creating the Porting Guide (#121)
* Adds intial workflow for Porting Guide PR * Fixes the directory for the ansible documentation checkout * Fixes the directory for the new branch * Fixes the EOF error with qouting * Add steps to check what is there inside a directory * Edits the tar command * Fixes ansible versioning for Porting Guide * Fixes tar command for debuging * Fixes directory for PR * Fixes the names of the steps * Updates to the correct barnch * Fixes changes based on the review feedback Fixes changes based on the review feedback Updates based on the feedback * Cleans git and github steps for better security Provides secrets only in the necessary steps. Uses `--body-file` to `gh pr` command. * Edits to get Porting guide from ansible-build-data git repo * Checks out correct repo * Edits to retrive major version from user input * Removes redundant quote from PR text * Reformts abd general cleanup * Edits to working-directory * Updates based on feedback * Update .github/workflows/docsbuild-release.yaml Co-authored-by: Don Naro <[email protected]> * release porting guide workflow * use a reusable workflow * use plain git cmds instead of gha * More updates based on review feedback * Updates based on latest review feedback * Update .github/workflows/reusable-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/reusable-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/reusable-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/reusable-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Uses single workflow file Fetching porting guide from the ansible-build-data repo from the release PR branch. Creating Porting Guide PR using rst file. * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Creates draft PR * Updates workflow to comment on the new PR * Creates PR against devel branch * Adds ready_for_review PR type to pull_request event * Updates based on (Felix's) feedback Making the comment about the draft PR on the PR's body itself. * Update .github/workflows/ci.yaml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Adds types to pull_request_target * Removes unused identifier from the workflow step * Updates all missing env variables Removes extra step, fixes typo and ANSIBLE-VERSION-MAJOR calculation in Bash. * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> * Updates ANSIBLE_VERSION_MAJOR env variable creation * Update .github/workflows/release-porting-guide.yml Co-authored-by: Don Naro <[email protected]> * Removes id * Update .github/workflows/release-porting-guide.yml Co-authored-by: Felix Fontein <[email protected]> * Update .github/workflows/release-porting-guide.yml Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Don Naro <[email protected]> Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]> Co-authored-by: Felix Fontein <[email protected]>
1 parent c047609 commit efb5f3e

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ name: Ansible Docsite CI
99
- 'patchback/**'
1010
- 'pip-compile/**'
1111
pull_request:
12+
types:
13+
- opened # default
14+
- synchronize # default
15+
- reopened # default
16+
- ready_for_review # used in PRs created from GitHub Actions workflows
1217
workflow_dispatch:
1318

1419
jobs:

.github/workflows/labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
"on":
66
pull_request_target:
7+
types:
8+
- opened # default
9+
- synchronize # default
10+
- reopened # default
11+
- ready_for_review # used in PRs created from GitHub Actions workflows
712
branches:
813
- devel
914
- "stable-*"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: Ansible porting guide creation
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ansible-build-data-branch:
7+
description: >-
8+
Release Branch name from the Ansible Build data PR.
9+
(e.g. `refs/pull/1/merge`)
10+
required: true
11+
ansible-version:
12+
description: >-
13+
Exact release version. For example, 12.1.0
14+
required: true
15+
16+
jobs:
17+
upload-porting-guide:
18+
name: Extract the porting guide
19+
runs-on: ubuntu-latest
20+
env:
21+
GIT_BRANCH: "release/porting-guide-${{ inputs.ansible-version }}"
22+
ANSIBLE_VERSION_FULL: ${{ inputs.ansible-version }}
23+
CI_COMMIT_MESSAGE: >-
24+
Add the Ansible community ${{ inputs.ansible-version }} porting guide
25+
26+
steps:
27+
- name: Extract the major version
28+
run: echo "ANSIBLE_VERSION_MAJOR=${ANSIBLE_VERSION_FULL%%.*}" >> "${GITHUB_ENV}"
29+
shell: bash --noprofile --norc -O extglob -eEuo pipefail {0}
30+
31+
- name: Check out this repo src
32+
uses: actions/checkout@v4
33+
- name: Check out ansible-build-data
34+
uses: actions/checkout@v4
35+
with:
36+
repository: ansible-community/ansible-build-data
37+
ref: ${{ inputs.ansible-build-data-branch }}
38+
path: ansible-build-data
39+
40+
- name: Copy the RST file to the correct path
41+
run: >-
42+
cp -v
43+
"ansible-build-data/${ANSIBLE_VERSION_MAJOR}/porting_guide_${ANSIBLE_VERSION_MAJOR}.rst"
44+
docs/docsite/rst/porting_guides/
45+
46+
- name: Set up git
47+
run: |
48+
git switch --create "${GIT_BRANCH}"
49+
ACTOR_NAME="$(curl -s https://api.github.com/users/"${GITHUB_ACTOR}" | jq --raw-output '.name // .login')"
50+
git config --global user.name "${ACTOR_NAME}"
51+
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
52+
53+
- name: Add the porting guide
54+
run: git add docs/docsite/rst/porting_guides/"porting_guide_${ANSIBLE_VERSION_MAJOR}.rst"
55+
56+
- name: Commit the porting guide
57+
run: >-
58+
git diff-index --quiet HEAD ||
59+
git commit -m "${CI_COMMIT_MESSAGE}"
60+
61+
- name: Push to the repo
62+
run: git push origin "${GIT_BRANCH}"
63+
64+
- name: Create the porting guide PR as draft
65+
env:
66+
GITHUB_TOKEN: ${{ github.token }}
67+
PR_BODY_MESSAGE: |-
68+
##### SUMMARY
69+
70+
This is a draft PR. Please mark the PR as ready for review to trigger PR checks.
71+
72+
##### ISSUE TYPE
73+
74+
- Docs Pull Request
75+
76+
##### COMPONENT NAME
77+
78+
docs/docsite/rst/porting_guides/porting_guide_${{ env.ANSIBLE_VERSION_MAJOR }}.rst
79+
run: >-
80+
gh pr create
81+
--draft
82+
--base devel
83+
--head "${GIT_BRANCH}"
84+
--title "${CI_COMMIT_MESSAGE}"
85+
--body "${PR_BODY_MESSAGE}"

0 commit comments

Comments
 (0)