-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Streamline the difference check * Make doc updates support PRs * Experiment
- Loading branch information
Showing
1 changed file
with
12 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,21 +58,23 @@ jobs: | |
- name: Determine diff | ||
run: | | ||
set +e | ||
diff README.md README_TMP.md > arcaflow-docsgen.diff | ||
set -e | ||
echo "README_DIFF=$(cat arcaflow-docsgen.diff | wc -l)" >> $GITHUB_ENV | ||
echo "README_DIFF=$(cmp -s README.md README_TMP.md ; echo $?)" >> $GITHUB_ENV | ||
- name: Update README.md if necessary | ||
if: env.README_DIFF != 0 && !github.ref_protected | ||
- name: Update README.md if appropriate | ||
# The github.head_ref variable is only available for pull requests, | ||
# however, we probably shouldn't be updating the branch for anything | ||
# which isn't a PR, anyway! | ||
if: env.README_DIFF == 1 && github.event_name == 'pull_request' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GH_EMAIL: [email protected] | ||
GH_USERNAME: arcabot | ||
run: | | ||
mv README_TMP.md README.md | ||
git config --global user.name $GH_USERNAME | ||
git config --global user.email $GH_EMAIL | ||
git add README.md | ||
git commit -m 'Automatic update of README.md by arcaflow-docsgen arcabot' | ||
git push | ||
git fetch origin ${{ github.head_ref }} | ||
git checkout -f ${{ github.head_ref }} | ||
mv README_TMP.md README.md | ||
git commit -m 'Automatic update of README.md by arcaflow-docsgen arcabot' README.md | ||
git push origin HEAD:${{ github.head_ref }} | ||
git checkout -f refs/remotes/pull/${{ github.ref_name }} |