state update
should clean up after itself.
#1033
Workflow file for this run
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: Propagate-PR | |
# === Triggers === | |
"on": | |
pull_request: | |
types: | |
- closed | |
# === JOBS === | |
jobs: | |
# === Set target branch === | |
propagate: | |
name: Propagate to affected version branches | |
runs-on: ubuntu-20.04 | |
env: | |
ACTIVESTATE_CI: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
JIRA_USERNAME: ${{ secrets.JIRA_EMAIL }} | |
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} | |
timeout-minutes: 5 | |
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.base.ref, 'version/') | |
steps: | |
- # === Checkout code === | |
name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_AUTOMATION_TOKEN }} | |
- # === Install Go === | |
name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.20.x' | |
- # === Install State Tool === | |
name: Install State Tool | |
uses: ActiveState/setup-state-tool@v1 | |
- # === Setup === | |
name: Setup | |
shell: bash | |
run: | | |
# We specify our custom user because we need privileges to push to protected branches | |
git config user.name "AS-builds" | |
git config user.email "[email protected]" | |
- # === Preprocess === | |
name: Preprocess | |
shell: bash | |
run: state run preprocess -v | |
- # === Propagate PR === | |
name: Propagate PR | |
id: propagate_pr | |
shell: bash | |
run: go run scripts/ci/propagate-pr/main.go ${{ github.event.pull_request.number }} | |
continue-on-error: true | |
- # === Notify Slack of Failures === | |
name: Notify Slack of Failures | |
if: steps.propagate_pr.outcome == 'failure' | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"text": "Propagate-PR failed for ${{ github.event.pull_request.html_url }}\nFailure should be addressed by ${{ github.event.pull_request.user.login }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Propagate-PR failed for *<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>*\nFailure should be addressed by *${{ github.event.pull_request.user.login }}*" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Failed job: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- # === Fail If Propagate PR failed === | |
name: Fail If Propagate PR failed | |
if: steps.propagate_pr.outcome == 'failure' | |
shell: bash | |
run: exit 1 |