Automated commit 'Merge pull request #1897 from sailpoint/devrel-1884 #490
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
name: "Push IDN API Specs to Developer Portal" | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- idn/** | |
jobs: | |
push_idn_spec_workflow: | |
name: Push API spec changes | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the master branch request to run rsync | |
- name: Checkout PR branch | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
# Checkout the main branch of api-specs | |
- name: Checkout API Specs Repo | |
uses: actions/checkout@v2 | |
with: | |
repository: sailpoint-oss/developer.sailpoint.com | |
path: developer-community | |
ref: main | |
- name: Install rsync | |
run: | | |
sudo apt install rsync grsync | |
- name: Sync files between folders | |
run: | | |
CURRENT_SPEC_PATH="idn/" | |
NEW_API_SPEC_PATH="developer-community/static/api-specs/idn/" | |
rsync -cav --delete $CURRENT_SPEC_PATH $NEW_API_SPEC_PATH | |
cd developer-community | |
git config --unset-all http.https://github.com/.extraheader | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action Bot" | |
if git status --porcelain | grep -q .; then | |
# Changes are present | |
git add . | |
git commit -m "Automated commit by github action: ${{ github.run_id }}" | |
git remote set-url origin https://${{secrets.DEVREL_SERVICE_TOKEN}}@github.com/sailpoint-oss/developer.sailpoint.com.git | |
git remote -v | |
git push | |
else | |
# No changes are present | |
echo "No changes to commit" | |
fi | |
push_idn_spec_workflow-failure: | |
runs-on: ubuntu-latest | |
if: ${{ always() && (needs.push_idn_spec_workflow.result == 'failure' || needs.push_idn_spec_workflow.result == 'timed_out') }} | |
needs: | |
- push_idn_spec_workflow | |
steps: | |
- name: Invoke GithubNotificationsFunction Lambda | |
run: | | |
curl -X POST \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"workflowName": "${{ github.job }}", | |
"repositoryName": "${{ github.event.repository.name }}", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' \ | |
"${{ secrets.NOTIFICATIONS_FUNCTION_URL }}" |