Skip to content

Commit

Permalink
[WIP] test workflow_run
Browse files Browse the repository at this point in the history
  • Loading branch information
WonyoungChoi committed Sep 27, 2021
1 parent 96b712b commit 7dbfff2
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/check-symbol.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Check Symbols

on:
workflow_run:
workflows: ["Build"]
types: [completed]

jobs:
check:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest

steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"

- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: flutter-tizen/tizen_allowlist
token: ${{ secrets.MY_PAT }}
path: tizen_allowlist
- uses: TizenAPI/tizenfx-build-actions/download-workflow-artifacts@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
path: artifacts
unzip: false
- name: check symbols
id: check
env:
ALLOWLIST: tizen_allowlist/4.0.0_native_whitelist_wearable_v12.txt
run: |
for f in $(ls -1 artifacts/*.zip); do
unzip -d ${f%.*} $f
done
find artifacts/ -name "libflutter_engine.so" -o -name "libflutter_tizen_wearable.so" |
xargs ci/docker/tizen/tools/check-symbol.py --allowlist=$ALLOWLIST
- name: commit status
uses: actions/github-script@v5
with:
script: |
async function commitStatus(state, description, target_url) {
for (const pr of context.payload.workflow_run.pull_requests) {
if (pr.base.repo.url == context.payload.repository.url) {
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: pr.head.sha,
context: "Check Symbols",
state: state,
description: description,
target_url: target_url,
});
}
}
}
if ('${{ steps.check.outcome }}' == 'success') {
commitStatus('success', 'All symbols are valid');
}
else if ('${{ steps.check.outcome }}' == 'failure') {
commitStatus(
"failure",
"Some symbols are invalid",
"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
);
}

0 comments on commit 7dbfff2

Please sign in to comment.