Skip to content

Commit 6100b1a

Browse files
authored
Merge pull request #18 from pbs/feature/run_docs_script_in_ci
Allowing document script to be run in CI
2 parents 2a73d31 + e0689ae commit 6100b1a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/document.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ jobs:
2121
- name: "Checkout"
2222
uses: actions/checkout@main
2323

24+
# This makes it easier to push changes back to the PR
25+
- name: "Checkout w/ gh"
26+
run: gh pr checkout ${{ github.event.pull_request.number}}
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
2430
- name: Setup asdf
2531
uses: asdf-vm/actions/setup@v2
2632

@@ -40,15 +46,21 @@ jobs:
4046
env:
4147
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4248

43-
- name: "Confirm"
49+
- name: "Commit if Necessary"
4450
run: |
4551
if [[ "$(basename "$(git rev-parse --show-toplevel)")" != *'terraform-aws-template'* ]]; then
4652
echo "Setting core.fileMode to false to avoid false positives in documentation check."
4753
git config core.fileMode false
4854
if [[ -n $(git status --porcelain) ]]; then
49-
echo "Documentation is not up to date. Run ./scripts/document.sh"
50-
git status -v
51-
git diff
52-
exit 1
55+
echo "Documentation is not up to date. Comitting updates"
56+
57+
git add README.md
58+
git config user.name "${GITHUB_USERNAME}"
59+
git config user.email "${GITHUB_USERNAME}@users.noreply.github.com"
60+
git commit -m "Running document script"
61+
git push
5362
fi
5463
fi
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
GITHUB_USERNAME: ${{ github.actor }}

0 commit comments

Comments
 (0)